File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed
tests/spec/another-query-params Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ export enum ContentType {
79
79
Json = "application/json" ,
80
80
FormData = "multipart/form-data" ,
81
81
UrlEncoded = "application/x-www-form-urlencoded" ,
82
+ Text = "text/plain" ,
82
83
}
83
84
84
85
export class HttpClient < SecurityDataType = unknown > {
@@ -133,6 +134,7 @@ export class HttpClient<SecurityDataType = unknown> {
133
134
private contentFormatters : Record < ContentType , ( input : any ) => any > = {
134
135
[ ContentType . Json ] : ( input : any ) =>
135
136
input !== null && ( typeof input === "object" || typeof input === "string" ) ? JSON . stringify ( input ) : input ,
137
+ [ ContentType . Text ] : ( input : any ) => ( input !== null && typeof input !== "string" ? JSON . stringify ( input ) : input ) ,
136
138
[ ContentType . FormData ] : ( input : any ) =>
137
139
Object . keys ( input || { } ) . reduce ( ( formData , key ) => {
138
140
const property = input [ key ] ;
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ export enum ContentType {
79
79
Json = "application/json" ,
80
80
FormData = "multipart/form-data" ,
81
81
UrlEncoded = "application/x-www-form-urlencoded" ,
82
+ Text = "text/plain" ,
82
83
}
83
84
84
85
export class HttpClient < SecurityDataType = unknown > {
@@ -133,6 +134,7 @@ export class HttpClient<SecurityDataType = unknown> {
133
134
private contentFormatters : Record < ContentType , ( input : any ) => any > = {
134
135
[ ContentType . Json ] : ( input : any ) =>
135
136
input !== null && ( typeof input === "object" || typeof input === "string" ) ? JSON . stringify ( input ) : input ,
137
+ [ ContentType . Text ] : ( input : any ) => ( input !== null && typeof input !== "string" ? JSON . stringify ( input ) : input ) ,
136
138
[ ContentType . FormData ] : ( input : any ) =>
137
139
Object . keys ( input || { } ) . reduce ( ( formData , key ) => {
138
140
const property = input [ key ] ;
You can’t perform that action at this time.
0 commit comments