Closed lettucebowler closed 1 year ago
I believe the issue is in this following code snipped from index.ts:
let [urlBase, queryParams = ''] = url_or_path.split('?') if (method === 'GET' && payload && typeof payload === 'object') { const merged = new URLSearchParams(queryParams) // @ts-expect-error ignore this const entries = (payload instanceof URLSearchParams ? payload : new URLSearchParams(payload)).entries() for (let [key, value] of entries) merged.append(key, value) queryParams = '?' + merged.toString() payload = null } const full_url = (options.base || '') + urlBase + queryParams
if the method is not GET, then when the url is reconstructed, the ? is lost, so a url like https://api.example.com/example?query=string becomes https://api.example.com/examplequery=string
This seems like a pretty simple fix, just need to move the logic to prepend ? to the querystring from inside the conditional out into the assignment to full_url. I'd be happy to submit a PR to make this change if preferred.
This should be addressed in the latest patch version - lemme know!
specifically v0.9.4 :)
v0.9.4
commit (for reference): d9e714c
I believe the issue is in this following code snipped from index.ts:
if the method is not GET, then when the url is reconstructed, the ? is lost, so a url like https://api.example.com/example?query=string becomes https://api.example.com/examplequery=string
This seems like a pretty simple fix, just need to move the logic to prepend ? to the querystring from inside the conditional out into the assignment to full_url. I'd be happy to submit a PR to make this change if preferred.