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

fixes not_nil runtime exception in json parser #804

Merged
merged 2 commits into from
May 27, 2018
Merged

Conversation

fridgerator
Copy link
Contributor

Description of the Change

Fixes #800

It is possible for the request body to be nil with a JSON request (DELETE request for example), causing Amber to log a 200 response whereas the actual response in the browser is 500.

This change checks for existence rather than using not_nil!.

Copy link
Member

@robacarp robacarp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Can a test be added to enforce this stays around?

@fridgerator
Copy link
Contributor Author

Parser specs did not exist, so I created a JSON parser spec and tested for both nil and not nil request body types

Copy link
Contributor

@faustinoaq faustinoaq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fridgerator Thank you! 👍

@drujensen drujensen merged commit 403f358 into master May 27, 2018
@drujensen drujensen deleted the nf/json_null_body branch May 27, 2018 16:00
@faustinoaq faustinoaq added this to the Version 0.8.0 milestone Jun 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants