-
Notifications
You must be signed in to change notification settings - Fork 3
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: Ensure CORS headers are still added when an error occurs in the authenticator #32
Conversation
The `rack.input` header was made optional, so we need to always set an input in our mock requests
- add_runtime_dependency is deprecated in favour of add_dependency - params are not required for `super` when the method signature is unchanged
5900b5c
to
9a0b16d
Compare
@@ -36,7 +36,7 @@ def json_body | |||
end | |||
|
|||
def body? | |||
has_header?('rack.input') | |||
has_header?(::Rack::RACK_INPUT) |
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.
ℹ️ not strictly necessary, but I always prefer to use constants when they're available
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.
Looks good to me :)
spec/specs/apia/endpoint_spec.rb
Outdated
response = endpoint.execute(request) | ||
expect(response.headers['Access-Control-Allow-Origin']).to eq 'example.com' | ||
expect(response.headers['Access-Control-Allow-Methods']).to eq 'GET, POST' | ||
expect(response.headers['Access-Control-Allow-Headers']).to eq 'X-Custom' |
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.
nitpick: Just for the sake of completeness, might as well assert that response status is 500 :)
Also fix CI issues:
rack.input
is not longer set by default in mock request, so we need to always set itsuper
when the method signature is unchanged