Skip to content

Commit

Permalink
Merge pull request #185 from algoo/fix/184_do_not_load_body_for_check…
Browse files Browse the repository at this point in the history
…_in_pyramid_context

do not check body in pyramid context
  • Loading branch information
inkhey authored Jun 7, 2019
2 parents 9369cfe + 7b93177 commit 0e05b37
Showing 1 changed file with 8 additions and 3 deletions.
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

0 comments on commit 0e05b37

Please sign in to comment.