mirror of https://github.com/sundowndev/http.git
fix: remove leading slash when using prefixUrl (#96)
parent
a6026cfb6b
commit
10fbd67966
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue