diff --git a/package.json b/package.json index e9a2c7795..f60378660 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "url-parse-lax": "^3.0.0" }, "devDependencies": { - "ava": "^1.0.1", + "ava": "^1.1.0", "coveralls": "^3.0.0", "delay": "^4.1.0", "form-data": "^2.3.3", @@ -61,8 +61,8 @@ "slow-stream": "0.0.4", "tempfile": "^2.0.0", "tempy": "^0.2.1", - "tough-cookie": "^2.4.3", - "xo": "^0.23.0" + "tough-cookie": "^3.0.0", + "xo": "^0.24.0" }, "ava": { "concurrency": 4 diff --git a/source/as-promise.js b/source/as-promise.js index cd11c5a2e..c5023253f 100644 --- a/source/as-promise.js +++ b/source/as-promise.js @@ -81,6 +81,7 @@ const asPromise = options => { resolve(response); } + return; } diff --git a/source/as-stream.js b/source/as-stream.js index 09da65645..98c5342df 100644 --- a/source/as-stream.js +++ b/source/as-stream.js @@ -83,6 +83,7 @@ module.exports = options => { return result; }; + proxy.unpipe = stream => { piped.delete(stream); return unpipe(stream); diff --git a/source/errors.js b/source/errors.js index fcf954802..b6cbadc3c 100644 --- a/source/errors.js +++ b/source/errors.js @@ -69,6 +69,7 @@ module.exports.HTTPError = class extends GotError { } else { statusMessage = http.STATUS_CODES[statusCode]; } + super(`Response code ${statusCode} (${statusMessage})`, {}, options); this.name = 'HTTPError'; this.statusCode = statusCode; diff --git a/source/normalize-arguments.js b/source/normalize-arguments.js index 2aa756c0c..2cdd41d8a 100644 --- a/source/normalize-arguments.js +++ b/source/normalize-arguments.js @@ -49,6 +49,7 @@ const preNormalize = (options, defaults) => { } else if (is.object(options.timeout)) { options.gotTimeout = options.timeout; } + delete options.timeout; const {retry} = options; @@ -138,6 +139,7 @@ const normalize = (url, options, defaults) => { if (!is.string(query)) { options.query = (new URLSearchParams(query)).toString(); } + options.path = `${options.path.split('?')[0]}?${options.query}`; delete options.query; } diff --git a/test/arguments.js b/test/arguments.js index db6216704..553373961 100644 --- a/test/arguments.js +++ b/test/arguments.js @@ -1,3 +1,4 @@ +/* eslint-disable node/no-deprecated-api */ import {URL, URLSearchParams, parse} from 'url'; import test from 'ava'; import pEvent from 'p-event'; diff --git a/test/cache.js b/test/cache.js index 979f1023a..7fd961bc8 100644 --- a/test/cache.js +++ b/test/cache.js @@ -40,6 +40,7 @@ test.before('setup', async () => { response.setHeader('Location', `${s.url}/302`); response.statusCode = 301; } + response.end(); status301Index++; }); @@ -51,6 +52,7 @@ test.before('setup', async () => { response.setHeader('Location', `${s.url}/cache`); response.statusCode = 302; } + response.end(); status302Index++; }); diff --git a/test/error.js b/test/error.js index cb81312aa..749b91f19 100644 --- a/test/error.js +++ b/test/error.js @@ -175,6 +175,7 @@ test('catch error in mimicResponse', async t => { const mimicResponse = () => { throw new Error('Error in mimic-response'); }; + mimicResponse['@global'] = true; const proxiedGot = proxyquire('..', { diff --git a/test/redirects.js b/test/redirects.js index dbff25f95..4f09503b3 100644 --- a/test/redirects.js +++ b/test/redirects.js @@ -10,6 +10,7 @@ test.before('setup', async () => { const reached = (request, response) => { response.end('reached'); }; + https = await createSSLServer(); http = await createServer(); diff --git a/test/socket-destroyed.js b/test/socket-destroyed.js index e504a3c93..038d2bbfe 100644 --- a/test/socket-destroyed.js +++ b/test/socket-destroyed.js @@ -1,6 +1,7 @@ import test from 'ava'; import got from '../source'; +// eslint-disable-next-line node/no-deprecated-api const {Timer} = process.binding('timer_wrap'); test.serial('clear the progressInterval if the socket has been destroyed', async t => { diff --git a/test/timeout.js b/test/timeout.js index dc37ad0a8..d98e95540 100644 --- a/test/timeout.js +++ b/test/timeout.js @@ -18,6 +18,7 @@ const slowDataStream = () => { if (count++ < 10) { return slowStream.push('data\n'.repeat(100)); } + clearInterval(interval); slowStream.push(null); }, 100); diff --git a/test/url-to-options.js b/test/url-to-options.js index ccffbe52c..4692b4ddb 100644 --- a/test/url-to-options.js +++ b/test/url-to-options.js @@ -1,3 +1,4 @@ +/* eslint-disable node/no-deprecated-api */ import url from 'url'; import test from 'ava'; import urlToOptions from '../source/utils/url-to-options';