-
Notifications
You must be signed in to change notification settings - Fork 84
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
Set json template for DELETE requests #1090
Set json template for DELETE requests #1090
Conversation
This fixes python-gnocchiclient issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM that should be tested though :/
b266436
to
543ee99
Compare
Setting template to expose() to json is cleaner than hardcoding application/json (pecan will set that content type if template is json [1]). It defaults to using text/html if nothing is given [2]. I don't know any good way to test it since it doesn't change the actual response but only the internal logic that Pecan doesn't error out [3] when it doesn't know the content-type is should use (since we are setting guess_content_type_from_ext=False in pecan config). [1] https://github.com/pecan/pecan/blob/master/pecan/decorators.py#L53 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That could be tested with Gabbi?
Let me check. |
Setting expose to json will cause content-type internally for Pecan to be set to application/json. If this is not set Pecan will throw a NotAcceptable error if it cannot parse or understand what type of request it is. This does not affect the content-type in the response for DELETE calls.
543ee99
to
ba5d73d
Compare
@jd something like this? I verified the tests passes before the expose() change. |
Yes, something like that :) |
Adding oslo.policy pin here, might be the one causing postgresql job to have issues. |
@Mergifyio backport stable/4.4 |
✅ Backports have been created
|
Set json template for DELETE requests (backport #1090)
We hardcode the content-type on all DELETE requests
otherwise Pecan will throw NotAcceptable errors when
doing requests to the APIs without any content-type set
and will default to text/html.