File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -368,20 +368,24 @@ var SwaggerResource = function(resourceObj, api) {
368368 }
369369}
370370
371- SwaggerResource . prototype . getAbsoluteBasePath = function ( relativeBasePath ) {
372- var parts , pos , url ;
371+ SwaggerResource . prototype . getAbsoluteBasePath = function ( relativeBasePath ) {
372+ var pos , url ;
373373 url = this . api . basePath ;
374374 pos = url . lastIndexOf ( relativeBasePath ) ;
375- if ( pos === - 1 ) {
376- parts = url . split ( "/" ) ;
377- url = parts [ 0 ] + "//" + parts [ 2 ] ;
375+ var parts = url . split ( "/" ) ;
376+ var rootUrl = parts [ 0 ] + "//" + parts [ 2 ] ;
377+ //if the relative path is '/' return the root url
378+ if ( relativeBasePath === '/' ) {
379+ return rootUrl
380+ }
381+ //if the relative path is not in the base path
382+ else if ( pos === - 1 ) {
378383 if ( relativeBasePath . indexOf ( "/" ) === 0 ) {
379384 return url + relativeBasePath ;
380385 } else {
381386 return url + "/" + relativeBasePath ;
382387 }
383- } else if ( relativeBasePath === "/" ) {
384- return url . substring ( 0 , pos ) ;
388+ //If the relative path is in the base path
385389 } else {
386390 return url . substring ( 0 , pos ) + relativeBasePath ;
387391 }
You can’t perform that action at this time.
0 commit comments