Skip to content

Commit

Permalink
fix abort test
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Oct 15, 2014
1 parent c6c7a0d commit b5c82ba
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/urllib.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

var should = require('should');
var http = require('http');
var https = require('https');
var zlib = require('zlib');
var querystring = require('querystring');
var urlutil = require('url');
Expand Down Expand Up @@ -149,7 +148,7 @@ describe('urllib.test.js', function () {
});

it('should socket hang up by req.abort() before `response` event emit', function (done) {
var req = urllib.request(host + '/timeout', function (err, data, res) {
var req = urllib.request(host + '/timeout', {timeout: 500}, function (err, data, res) {
should.exist(err);
err.name.should.equal('RequestError');
err.stack.should.containEql('socket hang up');
Expand All @@ -158,7 +157,9 @@ describe('urllib.test.js', function () {
should.exist(res);
done();
});
req.abort();
setTimeout(function () {
req.abort();
}, 1);
});

// it('should res.socket.destroy() after `response` event emit', function (done) {
Expand Down

0 comments on commit b5c82ba

Please sign in to comment.