-
Notifications
You must be signed in to change notification settings - Fork 126
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
add authorization_source feature #478
Conversation
src/lib.rs
Outdated
|
||
if !self.authorization_source.is_empty() && req_headers.contains_key(&self.authorization_source) { | ||
let original = req_headers.remove(&self.authorization_source).unwrap(); | ||
req_headers.insert("authorization", original); |
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.
HeaderMap is case-insensitive: https://docs.rs/http/latest/http/header/index.html
Header names are normalized to lower case.
so we just use authorization
here.
// Start app server | ||
let app_server = MockServer::start(); | ||
let hello = app_server.mock(|when, then| { | ||
when.method(GET).path("/hello").header_exists("Authorization"); |
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.
header_exists
makes requests fail if it does not contain Authorization header. https://docs.rs/httpmock/latest/httpmock/struct.When.html#method.header_exists
This effectively validates the authorization_source behavior.
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.
LGTM
Issue #, if available:
#477
Description of changes:
Added
AWS_LWA_AUTHORIZATION_SOURCE
option to rename a specifed header name toAuthorization
. Details are in the linked issue.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.