mirror of
https://github.com/ferdikoomen/openapi-typescript-codegen.git
synced 2025-12-08 20:16:21 +00:00
Fixed #365
This commit is contained in:
parent
fe136fd235
commit
ceb1aef0c4
@ -2,13 +2,13 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import { getFormData } from './getFormData';
|
||||
import { getQueryString } from './getQueryString';
|
||||
import { OpenAPI } from './OpenAPI';
|
||||
import { RequestOptions } from './RequestOptions';
|
||||
import { requestUsingFetch } from './requestUsingFetch';
|
||||
import { requestUsingXHR } from './requestUsingXHR';
|
||||
import { Result } from './Result';
|
||||
import {getFormData} from './getFormData';
|
||||
import {getQueryString} from './getQueryString';
|
||||
import {OpenAPI} from './OpenAPI';
|
||||
import {RequestOptions} from './RequestOptions';
|
||||
import {requestUsingFetch} from './requestUsingFetch';
|
||||
import {requestUsingXHR} from './requestUsingXHR';
|
||||
import {Result} from './Result';
|
||||
|
||||
/**
|
||||
* Create the request.
|
||||
@ -62,6 +62,9 @@ export async function request(options: Readonly<RequestOptions>): Promise<Result
|
||||
if (options.body.type) {
|
||||
headers.append('Content-Type', options.body.type);
|
||||
}
|
||||
} else if (typeof options.body === 'string') {
|
||||
request.body = options.body;
|
||||
headers.append('Content-Type', 'text/plain');
|
||||
} else {
|
||||
request.body = JSON.stringify(options.body);
|
||||
headers.append('Content-Type', 'application/json');
|
||||
|
||||
@ -194,13 +194,13 @@ exports[`v2 should generate: ./test/result/v2/core/request.ts 1`] = `
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import { getFormData } from './getFormData';
|
||||
import { getQueryString } from './getQueryString';
|
||||
import { OpenAPI } from './OpenAPI';
|
||||
import { RequestOptions } from './RequestOptions';
|
||||
import { requestUsingFetch } from './requestUsingFetch';
|
||||
import { requestUsingXHR } from './requestUsingXHR';
|
||||
import { Result } from './Result';
|
||||
import {getFormData} from './getFormData';
|
||||
import {getQueryString} from './getQueryString';
|
||||
import {OpenAPI} from './OpenAPI';
|
||||
import {RequestOptions} from './RequestOptions';
|
||||
import {requestUsingFetch} from './requestUsingFetch';
|
||||
import {requestUsingXHR} from './requestUsingXHR';
|
||||
import {Result} from './Result';
|
||||
|
||||
/**
|
||||
* Create the request.
|
||||
@ -254,6 +254,9 @@ export async function request(options: Readonly<RequestOptions>): Promise<Result
|
||||
if (options.body.type) {
|
||||
headers.append('Content-Type', options.body.type);
|
||||
}
|
||||
} else if (typeof options.body === 'string') {
|
||||
request.body = options.body;
|
||||
headers.append('Content-Type', 'text/plain');
|
||||
} else {
|
||||
request.body = JSON.stringify(options.body);
|
||||
headers.append('Content-Type', 'application/json');
|
||||
@ -2681,13 +2684,13 @@ exports[`v3 should generate: ./test/result/v3/core/request.ts 1`] = `
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import { getFormData } from './getFormData';
|
||||
import { getQueryString } from './getQueryString';
|
||||
import { OpenAPI } from './OpenAPI';
|
||||
import { RequestOptions } from './RequestOptions';
|
||||
import { requestUsingFetch } from './requestUsingFetch';
|
||||
import { requestUsingXHR } from './requestUsingXHR';
|
||||
import { Result } from './Result';
|
||||
import {getFormData} from './getFormData';
|
||||
import {getQueryString} from './getQueryString';
|
||||
import {OpenAPI} from './OpenAPI';
|
||||
import {RequestOptions} from './RequestOptions';
|
||||
import {requestUsingFetch} from './requestUsingFetch';
|
||||
import {requestUsingXHR} from './requestUsingXHR';
|
||||
import {Result} from './Result';
|
||||
|
||||
/**
|
||||
* Create the request.
|
||||
@ -2741,6 +2744,9 @@ export async function request(options: Readonly<RequestOptions>): Promise<Result
|
||||
if (options.body.type) {
|
||||
headers.append('Content-Type', options.body.type);
|
||||
}
|
||||
} else if (typeof options.body === 'string') {
|
||||
request.body = options.body;
|
||||
headers.append('Content-Type', 'text/plain');
|
||||
} else {
|
||||
request.body = JSON.stringify(options.body);
|
||||
headers.append('Content-Type', 'application/json');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user