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 {
7979 Json = "application/json" ,
8080 FormData = "multipart/form-data" ,
8181 UrlEncoded = "application/x-www-form-urlencoded" ,
82+ Text = "text/plain" ,
8283}
8384
8485export class HttpClient < SecurityDataType = unknown > {
@@ -133,6 +134,7 @@ export class HttpClient<SecurityDataType = unknown> {
133134 private contentFormatters : Record < ContentType , ( input : any ) => any > = {
134135 [ ContentType . Json ] : ( input : any ) =>
135136 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 ) ,
136138 [ ContentType . FormData ] : ( input : any ) =>
137139 Object . keys ( input || { } ) . reduce ( ( formData , key ) => {
138140 const property = input [ key ] ;
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ export enum ContentType {
7979 Json = "application/json" ,
8080 FormData = "multipart/form-data" ,
8181 UrlEncoded = "application/x-www-form-urlencoded" ,
82+ Text = "text/plain" ,
8283}
8384
8485export class HttpClient < SecurityDataType = unknown > {
@@ -133,6 +134,7 @@ export class HttpClient<SecurityDataType = unknown> {
133134 private contentFormatters : Record < ContentType , ( input : any ) => any > = {
134135 [ ContentType . Json ] : ( input : any ) =>
135136 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 ) ,
136138 [ ContentType . FormData ] : ( input : any ) =>
137139 Object . keys ( input || { } ) . reduce ( ( formData , key ) => {
138140 const property = input [ key ] ;
You can’t perform that action at this time.
0 commit comments