Added support for PathPrefix, so swagger generated APIs can be hooked into xapp-frame... 49/4549/1 v0.4.18
authorJuha Hyttinen <juha.hyttinen@nokia.com>
Fri, 14 Aug 2020 08:38:06 +0000 (11:38 +0300)
committerJuha Hyttinen <juha.hyttinen@nokia.com>
Fri, 14 Aug 2020 08:39:57 +0000 (11:39 +0300)
Change-Id: I48e5218eae7b8515c271e714ec72d6df8b10b634
Signed-off-by: Juha Hyttinen <juha.hyttinen@nokia.com>
ci/Dockerfile
pkg/xapp/restapi.go

index a37b995..6e3d309 100755 (executable)
@@ -35,7 +35,7 @@ RUN apt-get update -y \
 RUN curl -s https://packagecloud.io/install/repositories/o-ran-sc/master/script.deb.sh | bash
 
 # RMR
-ARG RMRVERSION=4.0.5
+ARG RMRVERSION=4.1.2
 #RUN apt-get install -y rmr=${RMRVERSION} rmr-dev=${RMRVERSION}
 RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr_${RMRVERSION}_amd64.deb
 RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr-dev_${RMRVERSION}_amd64.deb
index 1eab7b6..922e42d 100755 (executable)
@@ -62,11 +62,15 @@ func (r *Router) serviceChecker(inner http.HandlerFunc) http.HandlerFunc {
 }
 
 func (r *Router) InjectRoute(url string, handler http.HandlerFunc, method string) *mux.Route {
-       return r.router.HandleFunc(url, r.serviceChecker(handler)).Methods(method)
+       return r.router.Path(url).HandlerFunc(r.serviceChecker(handler)).Methods(method)
 }
 
 func (r *Router) InjectQueryRoute(url string, h http.HandlerFunc, m string, q ...string) *mux.Route {
-       return r.router.HandleFunc(url, r.serviceChecker(h)).Methods(m).Queries(q...)
+       return r.router.Path(url).HandlerFunc(r.serviceChecker(h)).Methods(m).Queries(q...)
+}
+
+func (r *Router) InjectRoutePrefix(prefix string, handler http.HandlerFunc) *mux.Route {
+       return r.router.PathPrefix(prefix).HandlerFunc(r.serviceChecker(handler))
 }
 
 func (r *Router) InjectStatusCb(f StatusCb) {