Skip to content

Commit

Permalink
fix: res.requestUrls should be string array (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
leoner authored and fengmk2 committed Dec 29, 2017
1 parent 2051273 commit e3df75e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/urllib.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ exports.requestWithCallback = function requestWithCallback(url, args, callback)
debug('Request#%d %s %s with headers %j, options.path: %s',
reqId, method, url, options.headers, options.path);

args.requestUrls.push(url);
args.requestUrls.push(parsedUrl.href);

function onResponse(res) {
if (timing) {
Expand Down
3 changes: 2 additions & 1 deletion test/urllib.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,7 @@ describe('test/urllib.test.js', function () {
});
});

it('should listen request url, when request url is object', function (done) {
it('should listen request url is string, when request url is object', function (done) {
done = pedding(3, done);
var requestUrl = 'https://cn.bing.com/search?q=nodejs';

Expand All @@ -1459,6 +1459,7 @@ describe('test/urllib.test.js', function () {

urllib.on('response', function (info) {
assert(info.req.url === requestUrl);
assert(info.res.requestUrls[0] === requestUrl);
done();
});

Expand Down

0 comments on commit e3df75e

Please sign in to comment.