-
Notifications
You must be signed in to change notification settings - Fork 163
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 Authorization Header is removed even if it should not
(close #1016)
#1020
Conversation
/cc @VasilyStrelyaev |
if (typeof header === 'string' && AUTHORIZATION.headers.indexOf(header.toLowerCase()) !== -1) | ||
value = AUTHORIZATION.valuePrefix + value; | ||
|
||
nativeMethods.xhrSetRequestHeader.call(this, header, value); |
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.
return
/* eslint hammerhead/proto-methods: 2 */ | ||
|
||
export default { | ||
valuePrefix: 'hammerhead-prefix-by-client', |
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.
hammerhead-prefix-by-client
--> hammerhead|prefix|by-client
if (this.readyState === this.DONE) { | ||
var headers = JSON.parse(this.responseText); | ||
|
||
Object.keys(headers).forEach(function (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.
Just check 4 headers, without foreach
function
it('Should pass authorization headers which are defined by client for cross-domain request without credentials (GH-1016)', function (done) { | ||
var options = { | ||
url: proxy.openSession('http://127.0.0.1:2002/echo-headers-with-credentials', session), | ||
headers: AUTHORIZATION.headers.reduce(function (obj, header, index) { |
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.
Use more simple code - without reduce
, set all headers manualy
❌ Tests for the commit 2d4aba0 have failed. See details: |
✅ Tests for the commit 1081636 have passed. See details: |
/cc @churkin @miherlosev