From 47203ea41f20ad3d533b78d2b7bacf8211126eb2 Mon Sep 17 00:00:00 2001 From: Yi-Jacob Date: Sat, 18 May 2024 18:43:48 -0500 Subject: [PATCH] decode url params --- .../df-api-docs/df-api-docs.component.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/adf-api-docs/df-api-docs/df-api-docs.component.ts b/src/app/adf-api-docs/df-api-docs/df-api-docs.component.ts index c7f0eea5..e063080b 100644 --- a/src/app/adf-api-docs/df-api-docs/df-api-docs.component.ts +++ b/src/app/adf-api-docs/df-api-docs/df-api-docs.component.ts @@ -53,16 +53,16 @@ export class DfApiDocsComponent implements OnInit, AfterContentInit { domNode: this.apiDocElement?.nativeElement, requestInterceptor: (req: SwaggerUI.Request) => { req['headers'][SESSION_TOKEN_HEADER] = this.userDataService.token; + // Parse the request URL const url = new URL(req['url']); const params = new URLSearchParams(url.search); - if (params.has('fields')) { - params.set( - 'fields', - decodeURIComponent(params.get('fields')?.toString() || '') - ); - url.search = params.toString(); - req['url'] = url.toString(); - } + // Decode all parameters + params.forEach((value, key) => { + params.set(key, decodeURIComponent(value)); + }); + // Update the URL with decoded parameters + url.search = params.toString(); + req['url'] = url.toString(); return req; }, showMutatedRequest: true,