Skip to content

Commit fa4fa33

Browse files
committed
Merge pull request socketio#1690 from rase-/fix/resource-option-bc
Fix resource option BC with the set function
2 parents bafa184 + b4954d7 commit fa4fa33

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ Server.prototype.attach = function(srv, opts){
216216

217217
// set engine.io path to `/socket.io`
218218
opts = opts || {};
219-
opts.path = opts.path || '/socket.io';
219+
opts.path = opts.path || this.path();
220220
// set origins verification
221221
opts.allowRequest = this.checkRequest.bind(this);
222222

test/socket.io.js

+15-4
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,21 @@ describe('socket.io', function(){
5151
expect(srv.eio.maxHttpBufferSize).to.eql(10);
5252
});
5353

54-
it('should be able to set path with setting resource', function() {
55-
var srv = io(http());
56-
srv.set('resource', '/random');
57-
expect(srv.path()).to.be('/random');
54+
it('should be able to set path with setting resource', function(done) {
55+
var eio = io();
56+
var srv = http();
57+
58+
eio.set('resource', '/random');
59+
eio.attach(srv);
60+
61+
// Check that the server is accessible through the specified path
62+
request(srv)
63+
.get('/random/socket.io.js')
64+
.buffer(true)
65+
.end(function(err, res){
66+
if (err) return done(err);
67+
done();
68+
});
5869
});
5970

6071
it('should be able to set origins to engine.io', function() {

0 commit comments

Comments
 (0)