Skip to content

Commit

Permalink
decode url params
Browse files Browse the repository at this point in the history
  • Loading branch information
Yi-Jacob committed May 18, 2024
1 parent 4b73361 commit 47203ea
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/app/adf-api-docs/df-api-docs/df-api-docs.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 47203ea

Please sign in to comment.