Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

fix: double slash in fetch backend path construction #53

Merged
merged 1 commit into from
Apr 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/backends/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class FetchClient {
http (options) {
const body = JSON.stringify(options.body)
const url = new URL(this.url)
url.pathname += options.pathname
// trim trailing slashes
url.pathname = url.pathname.replace(/\/$/, '') + options.pathname
const searchParams = new URLSearchParams(options.parameters || options.qs)
url.search = searchParams

Expand Down