Skip to content

Commit

Permalink
URI encode request parameters in the SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
MytsV authored and maany committed Oct 29, 2024
1 parent 4f28f46 commit d3869f0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/sdk/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ export function prepareRequestArgs(request: HTTPRequest): {
} {
if (request.params) {
const url = new URL(request.url);
Object.keys(request.params).forEach(key => url.searchParams.append(key, request.params![key]));
Object.keys(request.params).forEach(key => {
const encodedValue = encodeURIComponent(request.params![key]);
url.searchParams.append(key, encodedValue);
});
request.url = url.toString();
}
const requestArgs: RequestInit = {
Expand Down

0 comments on commit d3869f0

Please sign in to comment.