fix: remove leading slash when using prefixUrl (#96)

master
Kevin Marrec 2020-04-29 19:54:55 +02:00 committed by GitHub
parent a6026cfb6b
commit 10fbd67966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -82,6 +82,9 @@ for (let method of ['get', 'head', 'delete', 'post', 'put', 'patch']) {
if (/^https?/.test(url)) { if (/^https?/.test(url)) {
delete _options.prefixUrl 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 { try {