Add test for constructing Request with parsed URL object

This commit is contained in:
Timothy Gu 2016-10-12 19:25:00 -07:00
parent 53e1055845
commit b092a8ed12
1 changed files with 12 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import {spawn} from 'child_process';
import * as stream from 'stream';
import resumer from 'resumer';
import FormData from 'form-data';
import {parse as parseURL} from 'url';
import * as http from 'http';
import * as fs from 'fs';
@ -1382,6 +1383,17 @@ describe(`node-fetch with FOLLOW_SPEC = ${defaultFollowSpec}`, () => {
});
});
it('should support fetch with Node.js URL object', function() {
url = `${base}hello`;
const urlObj = parseURL(url);
const req = new Request(urlObj);
return fetch(req).then(res => {
expect(res.url).to.equal(url);
expect(res.ok).to.be.true;
expect(res.status).to.equal(200);
});
});
it('should support wrapping Request instance', function() {
url = `${base}hello`;