-
Notifications
You must be signed in to change notification settings - Fork 887
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
Routes gets generated differently with route_prefix #2143
Comments
In pyramid the leading |
It is apparently trying to validate the request against the Swagger spec (that it is one of the documented requests and that it further has all required information and such). Note that at the time this is being done, "request.matched_route" is None. Also the "pattern" member of the route object (which I assume is what should have been set in matched_route — perhaps this tween is too early for that to happen?) is also set without the leading "/". And yes, I do realize that Pyramid does not differentiate between a "path/to/request" vs. a "/path/to/request", but I would kind of hope it would at least be consistent in which ones it generates (using route_prefix with config.include vs. not); the config.include(route_prefix='/some/path') did have the prefix, yet the generated one did not. Note that I am just (trying to be) a consumer of both of these packages. 😄 |
This was fixed downstream in Yelp/pyramid_swagger/pull/151 |
So I encountered an issue when trying to use pyramid_swagger for a project, where it would sometimes not match my requests to the spec.
I tracked this down to different behavior depending on how the routes were created, in that any path that was fully qualified from the outset generates a fully qualified path from root (a leading "/"), while those generated by utilizing
config.include(..., route_prefix='/some/prefix')
generates entries without the leading "/".The following simple code illustrates the difference:
And the corresponding output from that looks like:
Note how one of the entries has the leading "/" while the other does not...
The text was updated successfully, but these errors were encountered: