diff --git a/README.md b/README.md index e82520c..a5d2dda 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Coverage Status](https://coveralls.io/repos/github/Rob--W/proxy-from-env/badge.svg?branch=master)](https://coveralls.io/github/Rob--W/proxy-from-env?branch=master) `proxy-from-env` is a Node.js package that exports a function (`getProxyForUrl`) -that takes an input URL (a string or +that takes an input URL (a string, a `URL` instance, or [`url.parse`](https://nodejs.org/docs/latest/api/url.html#url_url_parsing)'s return value) and returns the desired proxy URL (also a string) based on standard proxy environment variables. If no proxy is set, an empty string is diff --git a/index.js b/index.js index df75004..d051de5 100644 --- a/index.js +++ b/index.js @@ -17,7 +17,7 @@ var stringEndsWith = String.prototype.endsWith || function(s) { }; /** - * @param {string|object} url - The URL, or the result from url.parse. + * @param {string|url.Url|URL} url - The URL, or the result from url.parse. * @return {string} The URL of the proxy that should handle the request to the * given URL. If no proxy is set, this will be an empty string. */ diff --git a/test.js b/test.js index abf6542..7f6f95d 100644 --- a/test.js +++ b/test.js @@ -92,6 +92,7 @@ describe('getProxyForUrl', function() { testProxyUrl(env, '', 'https://example'); testProxyUrl(env, 'http://http-proxy', 'http://example'); testProxyUrl(env, 'http://http-proxy', parseUrl('http://example')); + testProxyUrl(env, 'http://http-proxy', new URL('http://example')); // eslint-disable-next-line camelcase env.http_proxy = 'http://priority';