This repository was archived by the owner on Mar 8, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -47,24 +47,28 @@ import { OpenAPI } from './OpenAPI';
47
47
{{> functions/catchErrors }}
48
48
49
49
50
+ interface ApiResultWithHeaders extends ApiResult {
51
+ headers: Headers;
52
+ }
53
+
50
54
/**
51
55
* Request using fetch client
52
56
* @param options The request options from the the service
53
57
* @returns ApiResult
54
58
* @throws ApiError
55
59
*/
56
- export async function request(options: ApiRequestOptions): Promise<ApiResult > {
60
+ export async function request(options: ApiRequestOptions): Promise<ApiResultWithHeaders > {
57
61
const url = getUrl(options);
58
62
const response = await sendRequest(options, url);
59
63
const responseBody = await getResponseBody(response);
60
- const responseHeader = getResponseHeader(response, options.responseHeader);
61
64
62
- const result: ApiResult = {
65
+ const result: ApiResultWithHeaders = {
63
66
url,
64
67
ok: response.ok,
65
68
status: response.status,
66
69
statusText: response.statusText,
67
70
body: responseHeader || responseBody,
71
+ headers: response.headers,
68
72
};
69
73
70
74
catchErrors(options, result);
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export class {{{name}}} {
35
35
{{ /each }}
36
36
* @throws ApiError
37
37
*/
38
- public static async {{{ name }}} ({{> parameters }} ): Promise<{{ >result}}> {
38
+ public static async {{{ name }}} ({{> parameters }} ): Promise<{body: {{ >result }} ; headers: Headers }> {
39
39
const result = await __request({
40
40
method: '{{{ method }}} ',
41
41
path: `{{{ path }}} `,
You can’t perform that action at this time.
0 commit comments