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

do not check body in pyramid context #185

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions hapic/ext/pyramid/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,14 @@ def get_request_parameters(self, *args, **kwargs) -> RequestParameters:
req = args[-1] # TODO : Check
# TODO : move this code to check_json
# same idea as in : https://bottlepy.org/docs/dev/_modules/bottle.html#BaseRequest.json
if req.body and req.content_type in ("application/json", "application/json-rpc"):
json_body = req.json_body
# TODO : raise exception if not correct , return 400 if uncorrect instead ?
if req.content_type in ("application/json", "application/json-rpc"):
try:
json_body = req.json_body
# TODO - G.M - 2019-06-06 - raise exception if not correct ,
# return 400 if uncorrect instead ?
except Exception:
json_body = {}

else:
json_body = {}

Expand Down