Skip to content

Commit

Permalink
allow fullSwaggerJSONPath to be set in the cfg.
Browse files Browse the repository at this point in the history
In a Layer7 load balancer some of the basePath may be rewritten. As the code keeps assuming the fullSwaggerJSONPath is the concatenation of the basePath and swaggerJSON this will create an invalid url which will never return the docs. This is just a quick fix
  • Loading branch information
Tiago Relvao committed Nov 25, 2014
1 parent 4c98ea6 commit 4ef14e4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/swagger-express/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ function generate(opt) {
opt.swaggerVersion = descriptor.swaggerVersion;
opt.swaggerURL = descriptor.swaggerURL;
opt.swaggerJSON = descriptor.swaggerJSON;
opt.fullSwaggerJSONPath = url.parse(opt.basePath + opt.swaggerJSON).path;

if (!opt.fullSwaggerJSONPath) {
opt.fullSwaggerJSONPath = url.parse(opt.basePath + opt.swaggerJSON).path;
}

if (opt.apis) {
opt.apis.forEach(function (api) {
Expand Down

0 comments on commit 4ef14e4

Please sign in to comment.