Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Its call next middle ware after url matched routePrefix, it is wrong, we don't get JSON file. #20

Closed
rishabhchandel opened this issue Sep 21, 2017 · 2 comments
Assignees

Comments

@rishabhchandel
Copy link

I fix it manually via edit node_modules/koa2-swagger-ui/lib/index.js
return function koaSwaggerUi(ctx, next) {
if (options.routePrefix === false || ctx.path === options.routePrefix) {
ctx.type = 'text/html';
ctx.body = index(options);
return; //add return here
}
return next();
};

@scttcper scttcper self-assigned this Sep 21, 2017
@scttcper
Copy link
Owner

Adding a return there ends the koa request loop. Check that you don't have something setting the body to something else. Or put the middleware behind the router you use for everything else.

@rishabhchandel
Copy link
Author

in my case, it is middle of public and secured router. it is not possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants