You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Include extraParams in all HTTP requests (#4860)
* attaching queryParams from client config in getUrl Signed-off-by: rsb-tbg <69879226+rsb-tbg@users.noreply.github.com> * changed client queryParams to QueryDict for consistency and now merging both sets of params in getUrl if one or both exist Signed-off-by: rsb-tbg <69879226+rsb-tbg@users.noreply.github.com> * added tests Signed-off-by: rsb-tbg <69879226+rsb-tbg@users.noreply.github.com> --------- Signed-off-by: rsb-tbg <69879226+rsb-tbg@users.noreply.github.com>
This commit is contained in:
@@ -379,9 +379,12 @@ export class FetchHttpApi<O extends IHttpOpts> {
|
||||
? baseUrlWithFallback.slice(0, -1)
|
||||
: baseUrlWithFallback;
|
||||
const url = new URL(baseUrlWithoutTrailingSlash + (prefix ?? this.opts.prefix) + path);
|
||||
if (queryParams) {
|
||||
encodeParams(queryParams, url.searchParams);
|
||||
// If there are any params, encode and append them to the URL.
|
||||
if (this.opts.extraParams || queryParams) {
|
||||
const mergedParams = { ...this.opts.extraParams, ...queryParams };
|
||||
encodeParams(mergedParams, url.searchParams);
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user