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 f9ebe5e8..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,6 +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); + // 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, diff --git a/src/app/shared/utilities/case.ts b/src/app/shared/utilities/case.ts index eb99a8b5..f6cbb4f4 100644 --- a/src/app/shared/utilities/case.ts +++ b/src/app/shared/utilities/case.ts @@ -19,6 +19,27 @@ export function mapSnakeToCamel(obj: T): T { } } +// export const camelToSnakeString = (str: string) => +// str.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1_$2').toLowerCase(); + +// export function mapCamelToSnake(obj: T): T { +// if (Array.isArray(obj)) { +// return obj.map(item => mapCamelToSnake(item)) as unknown as T; +// } else if (typeof obj === 'object' && obj !== null) { +// const newObj: Record = {}; +// for (const key in obj) { +// if (Object.prototype.hasOwnProperty.call(obj, key)) { +// newObj[camelToSnakeString(key)] = mapCamelToSnake( +// (obj as Record)[key] +// ); +// } +// } +// return newObj as unknown as T; +// } else { +// return obj; +// } +// } + export const camelToSnakeString = (str: string) => str.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1_$2').toLowerCase(); @@ -29,9 +50,13 @@ export function mapCamelToSnake(obj: T): T { const newObj: Record = {}; for (const key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { - newObj[camelToSnakeString(key)] = mapCamelToSnake( - (obj as Record)[key] - ); + if (key === 'requestBody') { + newObj[key] = (obj as Record)[key]; + } else { + newObj[camelToSnakeString(key)] = mapCamelToSnake( + (obj as Record)[key] + ); + } } } return newObj as unknown as T;