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> {
115
115
body = this.createFormData(body as Record<string , unknown >);
116
116
}
117
117
118
+ if (type === ContentType.Text && body && body !== null && typeof body !== "string") {
119
+ body = JSON.stringify(body);
120
+ }
121
+
118
122
return this.instance.request({
119
123
...requestParams,
120
124
headers: {
Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ export class HttpClient<SecurityDataType = unknown> {
103
103
104
104
private contentFormatters: Record<ContentType , (input: any) => any> = {
105
105
[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,
106
107
[ContentType.FormData]: (input: any) =>
107
108
Object.keys(input || {}).reduce((formData, key) => {
108
109
const property = input[key];
You can’t perform that action at this time.
0 commit comments