Makes sure all converters keys are lowercased before any conversion is taking place: dataTypes' names are now truly case insensitive. Unit test edited.
This commit is contained in:
parent
485fa0c42a
commit
7c9a5e6016
2 changed files with 16 additions and 5 deletions
13
src/ajax.js
13
src/ajax.js
|
@ -842,8 +842,9 @@ function ajaxConvert( s, response ) {
|
|||
}
|
||||
|
||||
var dataTypes = s.dataTypes,
|
||||
converters = s.converters,
|
||||
converters = {},
|
||||
i,
|
||||
key,
|
||||
length = dataTypes.length,
|
||||
tmp,
|
||||
// Current and previous dataTypes
|
||||
|
@ -860,6 +861,16 @@ function ajaxConvert( s, response ) {
|
|||
// For each dataType in the chain
|
||||
for( i = 1; i < length; i++ ) {
|
||||
|
||||
// Create converters map
|
||||
// with lowercased keys
|
||||
if ( i === 1 ) {
|
||||
for( key in s.converters ) {
|
||||
if( typeof key === "string" ) {
|
||||
converters[ key.toLowerCase() ] = s.converters[ key ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the dataTypes
|
||||
prev = current;
|
||||
current = dataTypes[ i ];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue