Skip to content

Commit

Permalink
fix how the swagger-resources endpoint is built
Browse files Browse the repository at this point in the history
  • Loading branch information
ecostanzi committed Sep 2, 2019
1 parent bfb1256 commit f96ecbb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions generators/openapi-client/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ module.exports = {
function fetchSwaggerResources(input) {
const availableDocs = [];

const swaggerResources = request('GET', `${input}/swagger-resources`, {
const baseUrl = input.replace(/\/$/, '');
const swaggerResources = request('GET', `${baseUrl}/swagger-resources`, {
// This header is needed to use the custom /swagger-resources controller
// and not the default one that has only the gateway's swagger resource
headers: { Accept: 'application/json, text/javascript;' }
});

JSON.parse(swaggerResources.getBody()).forEach(swaggerResource => {
const baseUrl = input.replace(/\/$/, '');
const specPath = swaggerResource.location.replace(/^\/+/g, '');
availableDocs.push({
value: { url: `${baseUrl}/${specPath}`, name: swaggerResource.name },
Expand Down

0 comments on commit f96ecbb

Please sign in to comment.