From f96ecbb5479aae3592385f6ff17e5a7ea62cdeda Mon Sep 17 00:00:00 2001 From: Enrico Costanzi Date: Tue, 25 Jun 2019 18:11:52 +0200 Subject: [PATCH] fix how the swagger-resources endpoint is built --- generators/openapi-client/prompts.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generators/openapi-client/prompts.js b/generators/openapi-client/prompts.js index 0bb783d6bf47..ec4c4409dd55 100644 --- a/generators/openapi-client/prompts.js +++ b/generators/openapi-client/prompts.js @@ -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 },