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