-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[#1719] Fix missing headers before error! call #1869
Conversation
b2149e1
to
adee5c0
Compare
I do see what you're trying to do, but this may possibly not be the right fix because Please fix the CHANGELOG either way to get a green build. |
lib/grape/dsl/inside_route.rb
Outdated
@@ -135,6 +135,7 @@ def version | |||
# @param message [String] The message to display. | |||
# @param status [Integer] the HTTP Status Code. Defaults to default_error_status, 500 if not set. | |||
def error!(message, status = nil, headers = nil) | |||
headers = headers.present? ? header.merge(headers) : header |
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.
There's a lot of header
vs. headers
going on here. I would rename headers = nil
into additional_headers
and use headers
everywhere else in the body of this method as header
and headers
are aliases for semantic reasons: use header
when accessing one and use headers
when accessing all.
adee5c0
to
e34f192
Compare
@dblock thanks for a quick review! I've updated naming (headers -> additional_headers). There is something about If I set
I suspect it comes from the
It's possible if user supposes that |
e34f192
to
081043b
Compare
@@ -134,8 +134,9 @@ def version | |||
# | |||
# @param message [String] The message to display. | |||
# @param status [Integer] the HTTP Status Code. Defaults to default_error_status, 500 if not set. | |||
def error!(message, status = nil, headers = nil) |
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.
I know it wasn't there, but lets document additional_headers
above?
Could you please document the new behavior in README, add a note to UPGRADING and write a spec that ensures the headers are actually merged as part of this PR? Thank you. |
@dblock I've added docs and specs. Let me know if any corrections needed. Should I squash and rebase? |
I squashed and merged. Thank you. Shoot an email to the grape mailing list describing this change and see what people say about it? Ask whether we need to support the previous behavior. |
@dblock cool! I sent an email. |
Fix issue with empty headers after
error!
method call #1719It happened when headers were set in
before
block or endpoint body.