@@ -208,6 +208,9 @@ async function sendRequest(options: ApiRequestOptions, url: string): Promise<Res
208
208
headers: await getHeaders(options),
209
209
body: getRequestBody(options),
210
210
};
211
+ if (OpenAPI.WITH_CREDENTIALS) {
212
+ request.credentials = 'include';
213
+ }
211
214
return await fetch(url, request);
212
215
}
213
216
@@ -263,7 +266,7 @@ function catchErrors(options: ApiRequestOptions, result: ApiResult): void {
263
266
/**
264
267
* Request using fetch client
265
268
* @param options The request options from the the service
266
- * @result ApiResult
269
+ * @returns ApiResult
267
270
* @throws ApiError
268
271
*/
269
272
export async function request(options: ApiRequestOptions): Promise<ApiResult> {
@@ -282,9 +285,7 @@ export async function request(options: ApiRequestOptions): Promise<ApiResult> {
282
285
283
286
catchErrors(options, result);
284
287
return result;
285
- }
286
-
287
- "
288
+ }"
288
289
`;
289
290
290
291
exports[`v2 should generate: ./test/generated/v2/index.ts 1`] = `
@@ -1730,7 +1731,7 @@ export class ComplexService {
1730
1731
/**
1731
1732
* @param parameterObject Parameter containing object
1732
1733
* @param parameterReference Parameter containing reference
1733
- * @result ModelWithString Successful response
1734
+ * @returns ModelWithString Successful response
1734
1735
* @throws ApiError
1735
1736
*/
1736
1737
public static async complexTypes(
@@ -1934,7 +1935,7 @@ import { OpenAPI } from '../core/OpenAPI';
1934
1935
export class HeaderService {
1935
1936
1936
1937
/**
1937
- * @result string Successful response
1938
+ * @returns string Successful response
1938
1939
* @throws ApiError
1939
1940
*/
1940
1941
public static async callWithResultFromHeader(): Promise<string> {
@@ -2046,7 +2047,7 @@ import { OpenAPI } from '../core/OpenAPI';
2046
2047
export class ResponseService {
2047
2048
2048
2049
/**
2049
- * @result ModelWithString Message for default response
2050
+ * @returns ModelWithString Message for default response
2050
2051
* @throws ApiError
2051
2052
*/
2052
2053
public static async callWithResponse(): Promise<ModelWithString> {
@@ -2058,7 +2059,7 @@ export class ResponseService {
2058
2059
}
2059
2060
2060
2061
/**
2061
- * @result ModelWithString Message for default response
2062
+ * @returns ModelWithString Message for default response
2062
2063
* @throws ApiError
2063
2064
*/
2064
2065
public static async callWithDuplicateResponses(): Promise<ModelWithString> {
@@ -2075,10 +2076,10 @@ export class ResponseService {
2075
2076
}
2076
2077
2077
2078
/**
2078
- * @result any Message for 200 response
2079
- * @result ModelWithString Message for default response
2080
- * @result ModelThatExtends Message for 201 response
2081
- * @result ModelThatExtendsExtends Message for 202 response
2079
+ * @returns any Message for 200 response
2080
+ * @returns ModelWithString Message for default response
2081
+ * @returns ModelThatExtends Message for 201 response
2082
+ * @returns ModelThatExtendsExtends Message for 202 response
2082
2083
* @throws ApiError
2083
2084
*/
2084
2085
public static async callWithResponses(): Promise<{
@@ -2208,10 +2209,10 @@ export class TypesService {
2208
2209
* @param parameterBoolean This is a boolean parameter
2209
2210
* @param parameterObject This is an object parameter
2210
2211
* @param id This is a number parameter
2211
- * @result number Response is a simple number
2212
- * @result string Response is a simple string
2213
- * @result boolean Response is a simple boolean
2214
- * @result any Response is a simple object
2212
+ * @returns number Response is a simple number
2213
+ * @returns string Response is a simple string
2214
+ * @returns boolean Response is a simple boolean
2215
+ * @returns any Response is a simple object
2215
2216
* @throws ApiError
2216
2217
*/
2217
2218
public static async types(
@@ -2451,6 +2452,9 @@ async function sendRequest(options: ApiRequestOptions, url: string): Promise<Res
2451
2452
headers: await getHeaders(options),
2452
2453
body: getRequestBody(options),
2453
2454
};
2455
+ if (OpenAPI.WITH_CREDENTIALS) {
2456
+ request.credentials = 'include';
2457
+ }
2454
2458
return await fetch(url, request);
2455
2459
}
2456
2460
@@ -2506,7 +2510,7 @@ function catchErrors(options: ApiRequestOptions, result: ApiResult): void {
2506
2510
/**
2507
2511
* Request using fetch client
2508
2512
* @param options The request options from the the service
2509
- * @result ApiResult
2513
+ * @returns ApiResult
2510
2514
* @throws ApiError
2511
2515
*/
2512
2516
export async function request(options: ApiRequestOptions): Promise<ApiResult> {
@@ -2525,9 +2529,7 @@ export async function request(options: ApiRequestOptions): Promise<ApiResult> {
2525
2529
2526
2530
catchErrors(options, result);
2527
2531
return result;
2528
- }
2529
-
2530
- "
2532
+ }"
2531
2533
`;
2532
2534
2533
2535
exports[`v3 should generate: ./test/generated/v3/index.ts 1`] = `
@@ -4244,7 +4246,7 @@ export class ComplexService {
4244
4246
/**
4245
4247
* @param parameterObject Parameter containing object
4246
4248
* @param parameterReference Parameter containing reference
4247
- * @result ModelWithString Successful response
4249
+ * @returns ModelWithString Successful response
4248
4250
* @throws ApiError
4249
4251
*/
4250
4252
public static async complexTypes(
@@ -4275,7 +4277,7 @@ export class ComplexService {
4275
4277
/**
4276
4278
* @param id
4277
4279
* @param requestBody
4278
- * @result ModelWithString Success
4280
+ * @returns ModelWithString Success
4279
4281
* @throws ApiError
4280
4282
*/
4281
4283
public static async complexParams(
@@ -4478,7 +4480,7 @@ import { OpenAPI } from '../core/OpenAPI';
4478
4480
export class HeaderService {
4479
4481
4480
4482
/**
4481
- * @result string Successful response
4483
+ * @returns string Successful response
4482
4484
* @throws ApiError
4483
4485
*/
4484
4486
public static async callWithResultFromHeader(): Promise<string> {
@@ -4507,7 +4509,7 @@ import { OpenAPI } from '../core/OpenAPI';
4507
4509
export class MultipartService {
4508
4510
4509
4511
/**
4510
- * @result any OK
4512
+ * @returns any OK
4511
4513
* @throws ApiError
4512
4514
*/
4513
4515
public static async multipartResponse(): Promise<{
@@ -4699,7 +4701,7 @@ import { OpenAPI } from '../core/OpenAPI';
4699
4701
export class ResponseService {
4700
4702
4701
4703
/**
4702
- * @result ModelWithString
4704
+ * @returns ModelWithString
4703
4705
* @throws ApiError
4704
4706
*/
4705
4707
public static async callWithResponse(): Promise<ModelWithString> {
@@ -4711,7 +4713,7 @@ export class ResponseService {
4711
4713
}
4712
4714
4713
4715
/**
4714
- * @result ModelWithString Message for default response
4716
+ * @returns ModelWithString Message for default response
4715
4717
* @throws ApiError
4716
4718
*/
4717
4719
public static async callWithDuplicateResponses(): Promise<ModelWithString> {
@@ -4728,10 +4730,10 @@ export class ResponseService {
4728
4730
}
4729
4731
4730
4732
/**
4731
- * @result any Message for 200 response
4732
- * @result ModelWithString Message for default response
4733
- * @result ModelThatExtends Message for 201 response
4734
- * @result ModelThatExtendsExtends Message for 202 response
4733
+ * @returns any Message for 200 response
4734
+ * @returns ModelWithString Message for default response
4735
+ * @returns ModelThatExtends Message for 201 response
4736
+ * @returns ModelThatExtendsExtends Message for 202 response
4735
4737
* @throws ApiError
4736
4738
*/
4737
4739
public static async callWithResponses(): Promise<{
@@ -4861,10 +4863,10 @@ export class TypesService {
4861
4863
* @param parameterString This is a string parameter
4862
4864
* @param parameterBoolean This is a boolean parameter
4863
4865
* @param id This is a number parameter
4864
- * @result number Response is a simple number
4865
- * @result string Response is a simple string
4866
- * @result boolean Response is a simple boolean
4867
- * @result any Response is a simple object
4866
+ * @returns number Response is a simple number
4867
+ * @returns string Response is a simple string
4868
+ * @returns boolean Response is a simple boolean
4869
+ * @returns any Response is a simple object
4868
4870
* @throws ApiError
4869
4871
*/
4870
4872
public static async types(
@@ -4907,7 +4909,7 @@ export class UploadService {
4907
4909
4908
4910
/**
4909
4911
* @param file Supply a file reference for upload
4910
- * @result boolean
4912
+ * @returns boolean
4911
4913
* @throws ApiError
4912
4914
*/
4913
4915
public static async uploadFile(
0 commit comments