File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ function empty () {}
31
31
function XHR ( opts ) {
32
32
Polling . call ( this , opts ) ;
33
33
this . requestTimeout = opts . requestTimeout ;
34
+ this . extraHeaders = opts . extraHeaders ;
34
35
35
36
if ( global . location ) {
36
37
var isSSL = 'https:' === location . protocol ;
@@ -44,8 +45,6 @@ function XHR (opts) {
44
45
this . xd = opts . hostname !== global . location . hostname ||
45
46
port !== opts . port ;
46
47
this . xs = opts . secure !== isSSL ;
47
- } else {
48
- this . extraHeaders = opts . extraHeaders ;
49
48
}
50
49
}
51
50
Original file line number Diff line number Diff line change @@ -294,4 +294,22 @@ describe('Transport', function () {
294
294
} ) ;
295
295
} ) ;
296
296
}
297
+
298
+ describe ( 'options' , function ( ) {
299
+ it ( 'should accept an `extraHeaders` option for XMLHttpRequest in browser' , function ( ) {
300
+ var headers = {
301
+ 'X-Custom-Header-For-My-Project' : 'my-secret-access-token' ,
302
+ 'Cookie' : 'user_session=NI2JlCKF90aE0sJZD9ZzujtdsUqNYSBYxzlTsvdSUe35ZzdtVRGqYFr0kdGxbfc5gUOkR9RGp20GVKza; path=/; expires=Tue, 07-Apr-2015 18:18:08 GMT; secure; HttpOnly'
303
+ } ;
304
+ var socket = new eio . Socket ( {
305
+ transportOptions : {
306
+ polling : {
307
+ extraHeaders : headers
308
+ }
309
+ }
310
+ } ) ;
311
+ expect ( socket . transport . name ) . to . be ( 'polling' ) ;
312
+ expect ( socket . transport . extraHeaders ) . to . equal ( headers ) ;
313
+ } ) ;
314
+ } ) ;
297
315
} ) ;
You can’t perform that action at this time.
0 commit comments