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

Fix issue with custom error handler on bad request #1351

Merged
merged 1 commit into from
Feb 6, 2018

Conversation

jkowens
Copy link
Member

@jkowens jkowens commented Oct 3, 2017

Make sure @params are initialized for an app, so that they exist if processing a request with a custom error handler. Currently if params are invalid an error is raised before @params is set, causing a NoMethodError for nil:NilClass down the chain. Fixes #1350.

Copy link
Member

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this!

@zzak
Copy link
Member

zzak commented Oct 29, 2017

#1339 candidate?

@olleolleolle
Copy link
Member

@zzak I think this fits a patch release. Include it!

@jkowens
Copy link
Member Author

jkowens commented Oct 30, 2017

I agree, this is a backwards compatible bug fix 👍

Copy link
Member

@namusyaka namusyaka left a comment

Choose a reason for hiding this comment

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

Looks good with a nit.
Thank you for the patch!

@@ -1086,7 +1087,7 @@ def invoke

# Dispatch a request with error handling.
def dispatch!
force_encoding(@params = IndifferentHash[@request.params])
force_encoding(@params = @params.merge(@request.params))
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason to not use the merge! method? It would be something like:

force_encoding(@params.merge!(@request.params))

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I'll make that update 👍

@namusyaka
Copy link
Member

Good. Thanks!

@namusyaka namusyaka merged commit d661739 into sinatra:master Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants