2
1
mirror of https://github.com/Thream/socketio-jwt.git synced 2024-07-21 09:38:31 +02:00
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);
};
};
};