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) {
1292
1292
1293
1293
obj . data = obj . body ;
1294
1294
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
+ }
1300
1312
1301
- out = {
1302
- headers : headers ,
1313
+ var out = {
1303
1314
url : request . url ,
1304
1315
method : request . method ,
1305
1316
status : response . status ,
You can’t perform that action at this time.
0 commit comments