File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
templates/base/http-clients Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,10 @@ export class HttpClient<SecurityDataType = unknown> {
115115 body = this.createFormData(body as Record<string , unknown >);
116116 }
117117
118+ if (type === ContentType.Text && body && body !== null && typeof body !== "string") {
119+ body = JSON.stringify(body);
120+ }
121+
118122 return this.instance.request({
119123 ...requestParams,
120124 headers: {
Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ export class HttpClient<SecurityDataType = unknown> {
103103
104104 private contentFormatters: Record<ContentType , (input: any) => any> = {
105105 [ContentType.Json]: (input:any) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
106+ [ContentType.Text]: (input:any) => input !== null && typeof input !== "string" ? JSON.stringify(input) : input,
106107 [ContentType.FormData]: (input: any) =>
107108 Object.keys(input || {}).reduce((formData, key) => {
108109 const property = input[key];
You can’t perform that action at this time.
0 commit comments