diff options
author | Andrei Fangli <andrei_fangli@outlook.com> | 2018-11-26 19:00:41 +0200 |
---|---|---|
committer | Timmy Willison <4timmywil@gmail.com> | 2018-11-26 12:00:41 -0500 |
commit | e0d941156900a6bff7c098c8ea7290528e468cf8 (patch) | |
tree | 5f0deeaf8fd98971364f57f66bd603e21326748f /src | |
parent | 3ac907864c4d36b4fcb58826d9cb0e4ed62334b2 (diff) | |
download | jquery-e0d941156900a6bff7c098c8ea7290528e468cf8.tar.gz jquery-e0d941156900a6bff7c098c8ea7290528e468cf8.zip |
Ajax: Fix getResponseHeader(key) for IE11
- getResponseHeader(key) combines all header values for the provided key into a
single result where values are concatenated by ', '. This does not happen for
IE11 since multiple values for the same header are returned on separate lines.
This makes the function only return the last value of the header for IE11.
- Updated ajax headers test to better cover Object.prototype collisions
Close gh-4173
Fixes gh-3403
Diffstat (limited to 'src')
-rw-r--r-- | src/ajax.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ajax.js b/src/ajax.js index aec26830a..4cbefabaa 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -459,12 +459,14 @@ jQuery.extend( { if ( !responseHeaders ) { responseHeaders = {}; while ( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; + responseHeaders[ match[ 1 ].toLowerCase() + " " ] = + ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) + .concat( match[ 2 ] ); } } - match = responseHeaders[ key.toLowerCase() ]; + match = responseHeaders[ key.toLowerCase() + " " ]; } - return match == null ? null : match; + return match == null ? null : match.join( ", " ); }, // Raw string |