@@ -194,13 +194,13 @@ exports[`v2 should generate: ./test/result/v2/core/request.ts 1`] = `
194
194
/* tslint:disable */
195
195
/* eslint-disable */
196
196
197
- import { getFormData } from './getFormData';
198
- import { getQueryString } from './getQueryString';
199
- import { OpenAPI } from './OpenAPI';
200
- import { RequestOptions } from './RequestOptions';
201
- import { requestUsingFetch } from './requestUsingFetch';
202
- import { requestUsingXHR } from './requestUsingXHR';
203
- import { Result } from './Result';
197
+ import {getFormData} from './getFormData';
198
+ import {getQueryString} from './getQueryString';
199
+ import {OpenAPI} from './OpenAPI';
200
+ import {RequestOptions} from './RequestOptions';
201
+ import {requestUsingFetch} from './requestUsingFetch';
202
+ import {requestUsingXHR} from './requestUsingXHR';
203
+ import {Result} from './Result';
204
204
205
205
/**
206
206
* Create the request.
@@ -254,6 +254,9 @@ export async function request(options: Readonly<RequestOptions>): Promise<Result
254
254
if (options.body.type) {
255
255
headers.append('Content-Type', options.body.type);
256
256
}
257
+ } else if (typeof options.body === 'string') {
258
+ request.body = options.body;
259
+ headers.append('Content-Type', 'text/plain');
257
260
} else {
258
261
request.body = JSON.stringify(options.body);
259
262
headers.append('Content-Type', 'application/json');
@@ -2681,13 +2684,13 @@ exports[`v3 should generate: ./test/result/v3/core/request.ts 1`] = `
2681
2684
/* tslint:disable */
2682
2685
/* eslint-disable */
2683
2686
2684
- import { getFormData } from './getFormData';
2685
- import { getQueryString } from './getQueryString';
2686
- import { OpenAPI } from './OpenAPI';
2687
- import { RequestOptions } from './RequestOptions';
2688
- import { requestUsingFetch } from './requestUsingFetch';
2689
- import { requestUsingXHR } from './requestUsingXHR';
2690
- import { Result } from './Result';
2687
+ import {getFormData} from './getFormData';
2688
+ import {getQueryString} from './getQueryString';
2689
+ import {OpenAPI} from './OpenAPI';
2690
+ import {RequestOptions} from './RequestOptions';
2691
+ import {requestUsingFetch} from './requestUsingFetch';
2692
+ import {requestUsingXHR} from './requestUsingXHR';
2693
+ import {Result} from './Result';
2691
2694
2692
2695
/**
2693
2696
* Create the request.
@@ -2741,6 +2744,9 @@ export async function request(options: Readonly<RequestOptions>): Promise<Result
2741
2744
if (options.body.type) {
2742
2745
headers.append('Content-Type', options.body.type);
2743
2746
}
2747
+ } else if (typeof options.body === 'string') {
2748
+ request.body = options.body;
2749
+ headers.append('Content-Type', 'text/plain');
2744
2750
} else {
2745
2751
request.body = JSON.stringify(options.body);
2746
2752
headers.append('Content-Type', 'application/json');
0 commit comments