Skip to content

Commit

Permalink
change internal access of hapi endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Thelen authored and Frank Thelen committed Aug 8, 2018
1 parent 10d38ab commit 04d1477
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,17 @@ const register = async (server, {
options: auth === undefined ? { cache } : { cache, auth },
handler: async (request, h) => {
try {
const response = await server.inject({
url: swaggerEndpoint,
headers: {
authorization: request.headers.authorization, // forward
...additionalHeaders,
},
});
const { payload } = response;
const swaggerObject = JSON.parse(payload);
const parser = new SwaggerParser();
const api = await parser.parse(`${server.info.uri}${swaggerEndpoint}`, {
const api = await parser.parse(swaggerObject, {
resolve: {
file: false, // don't resolve local file references
http: {
Expand Down

0 comments on commit 04d1477

Please sign in to comment.