Skip to content

Commit

Permalink
fix: remove leading slash when using prefixUrl (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinmarrec authored Apr 29, 2020
1 parent a6026cf commit 10fbd67
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 10fbd67

Please sign in to comment.