Skip to content

Commit

Permalink
Reworked PR #11 a bit to make ci green.
Browse files Browse the repository at this point in the history
Signed-off-by: Hermann Mayer <hermann.mayer92@gmail.com>
  • Loading branch information
Jack12816 committed Jan 16, 2024
1 parent cd25e51 commit 73a78bf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### next

* Implemented case-insensitive header value checks for Grape 2.0.0+ compatibility, aligning with HTTP/2+ semantics (#11)
* Implemented case-insensitive header value checks for Grape 2.0.0+ compatibility, aligning with HTTP/2+ semantics (#11, #12)
* Moved the development dependencies from the gemspec to the Gemfile (#10)

### 2.2.0
Expand Down
3 changes: 2 additions & 1 deletion lib/grape/jwt/authentication/jwt_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ def call(env)
Grape::Middleware::Formatter.new(->(_) {}).call(env)

# Parse the JWT token from the request headers.
# Downcase the header keys to account for HTTP/2+ semantics in Grape 2.0.0+
# Downcase the header keys to account for HTTP/2+
# semantics in Grape 2.0.0+
lowercase_env = env.transform_keys(&:downcase)
token = parse_token(lowercase_env['http_authorization'])

Expand Down
3 changes: 2 additions & 1 deletion spec/grape/jwt/grape_usage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ class API < Grape::API
end

it 'succeeds on a lowercase authorization header' do
get '/v1/test', {}, {'http_authorization' => "Bearer #{valid_token}"}
header 'authorization', "Bearer #{valid_token}"
get '/v1/test'
expect(last_response.body).to be_eql('{"test":true}')
end

Expand Down

0 comments on commit 73a78bf

Please sign in to comment.