diff --git a/lib/plugin.js b/lib/plugin.js index 614333d..e47325d 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -82,7 +82,10 @@ for (let method of ['get', 'head', 'delete', 'post', 'put', 'patch']) { if (/^https?/.test(url)) { delete _options.prefixUrl - } + } else if (_options.prefixUrl && typeof url === 'string' && url.startsWith('/')) { + // Prevents `ky` from throwing "`input` must not begin with a slash when using `prefixUrl`" + url = url.substr(1) + } try { const response = await this._ky[method](url, _options)