Skip to content

Commit 0b2eefe

Browse files
Jijo Jamesauvipy
Jijo James
authored andcommitted
Send correct status when info call fails
1 parent 2011ab1 commit 0b2eefe

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

lib/info-ajax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function InfoAjax(url, AjaxObject) {
3333
info = {};
3434
}
3535
}
36-
self.emit('finish', info, rtt);
36+
self.emit('finish', info, rtt, status);
3737
self.removeAllListeners();
3838
});
3939
}

lib/info-receiver.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ InfoReceiver.prototype.doXhr = function(baseUrl, urlInfo) {
6161
self.emit('finish');
6262
}, InfoReceiver.timeout);
6363

64-
this.xo.once('finish', function(info, rtt) {
64+
this.xo.once('finish', function(info, rtt, status) {
6565
debug('finish', info, rtt);
6666
self._cleanup(true);
67-
self.emit('finish', info, rtt);
67+
self.emit('finish', info, rtt, status);
6868
});
6969
};
7070

lib/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,11 @@ SockJS.OPEN = 1;
173173
SockJS.CLOSING = 2;
174174
SockJS.CLOSED = 3;
175175

176-
SockJS.prototype._receiveInfo = function(info, rtt) {
176+
SockJS.prototype._receiveInfo = function(info, rtt, status) {
177177
debug('_receiveInfo', rtt);
178178
this._ir = null;
179179
if (!info) {
180-
this._close(1002, 'Cannot connect to server');
180+
this._close(status || 1002, 'Cannot connect to server');
181181
return;
182182
}
183183

tests/lib/end-to-end.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('End to End', function () {
2626
}
2727

2828
try {
29-
expect(e.code).to.equal(1002);
29+
expect(e.code).to.equal(404);
3030
expect(e.reason).to.equal('Cannot connect to server');
3131
expect(e.wasClean).to.equal(false);
3232
} catch (err) {

0 commit comments

Comments
 (0)