This repository has been archived on 2024-11-11. You can view files and clone it, but cannot push or open issues or pull requests.
socketio-jwt/test/fixture/setSocketIOHandshakeCookies.js

20 lines
580 B
JavaScript
Raw Normal View History

2012-11-16 16:43:12 +01:00
var xmlhttprequest = require('xmlhttprequest');
var originalRequest = xmlhttprequest.XMLHttpRequest;
module.exports = function (jar) {
xmlhttprequest.XMLHttpRequest = function(){
originalRequest.apply(this, arguments);
this.setDisableHeaderCheck(true);
var stdOpen = this.open;
this.open = function() {
stdOpen.apply(this, arguments);
var header = jar.get({ url: 'http://localhost:9000' })
.map(function (c) {
return c.name + "=" + c.value;
}).join("; ");
this.setRequestHeader('cookie', header);
};
};
};