File tree Expand file tree Collapse file tree 3 files changed +42
-46
lines changed Expand file tree Collapse file tree 3 files changed +42
-46
lines changed Original file line number Diff line number Diff line change @@ -1292,14 +1292,25 @@ JQueryHttpClient.prototype.execute = function(obj) {
12921292
12931293 obj . data = obj . body ;
12941294 obj . complete = function ( response , textStatus , opts ) {
1295- headers = { } ;
1296- headerArray = response . getAllResponseHeaders ( ) . split ( ":" ) ;
1297-
1298- for ( var i = 0 ; i < headerArray . length / 2 ; i ++ )
1299- headers [ headerArray [ i ] = headerArray [ i + 1 ] ] ;
1295+ var headers = { } ,
1296+ headerArray = response . getAllResponseHeaders ( ) . split ( "\n" ) ;
1297+
1298+ for ( var i = 0 ; i < headerArray . length ; i ++ ) {
1299+ var toSplit = headerArray [ i ] . trim ( ) ;
1300+ if ( toSplit . length === 0 )
1301+ continue ;
1302+ var separator = toSplit . indexOf ( ":" ) ;
1303+ if ( separator === - 1 ) {
1304+ // Name but no value in the header
1305+ headers [ toSplit ] = null ;
1306+ continue ;
1307+ }
1308+ var name = toSplit . substring ( 0 , separator ) . trim ( ) ,
1309+ value = toSplit . substring ( separator + 1 ) . trim ( ) ;
1310+ headers [ name ] = value ;
1311+ }
13001312
1301- out = {
1302- headers : headers ,
1313+ var out = {
13031314 url : request . url ,
13041315 method : request . method ,
13051316 status : response . status ,
You can’t perform that action at this time.
0 commit comments