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 @@ -1290,14 +1290,25 @@ JQueryHttpClient.prototype.execute = function(obj) {
1290
1290
1291
1291
obj . data = obj . body ;
1292
1292
obj . complete = function ( response , textStatus , opts ) {
1293
- headers = { } ;
1294
- headerArray = response . getAllResponseHeaders ( ) . split ( ":" ) ;
1295
-
1296
- for ( var i = 0 ; i < headerArray . length / 2 ; i ++ )
1297
- headers [ headerArray [ i ] = headerArray [ i + 1 ] ] ;
1293
+ var headers = { } ,
1294
+ headerArray = response . getAllResponseHeaders ( ) . split ( "\n" ) ;
1295
+
1296
+ for ( var i = 0 ; i < headerArray . length ; i ++ ) {
1297
+ var toSplit = headerArray [ i ] . trim ( ) ;
1298
+ if ( toSplit . length === 0 )
1299
+ continue ;
1300
+ var separator = toSplit . indexOf ( ":" ) ;
1301
+ if ( separator === - 1 ) {
1302
+ // Name but no value in the header
1303
+ headers [ toSplit ] = null ;
1304
+ continue ;
1305
+ }
1306
+ var name = toSplit . substring ( 0 , separator ) . trim ( ) ,
1307
+ value = toSplit . substring ( separator + 1 ) . trim ( ) ;
1308
+ headers [ name ] = value ;
1309
+ }
1298
1310
1299
- out = {
1300
- headers : headers ,
1311
+ var out = {
1301
1312
url : request . url ,
1302
1313
method : request . method ,
1303
1314
status : response . status ,
You can’t perform that action at this time.
0 commit comments