Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.

Commit 762a265

Browse files
committed
Attach headers to output of request function
1 parent 3955cf1 commit 762a265

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/templates/core/axios/request.hbs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{{>header}}
2-
32
import axios from 'axios';
43
import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
54
import FormData from 'form-data';
@@ -197,7 +196,12 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions): C
197196

198197
catchErrorCodes(options, result);
199198

200-
resolve(result.body);
199+
// Attach the response headers to the output. This is a hack to fix
200+
// https://github.com/ferdikoomen/openapi-typescript-codegen/issues/1295
201+
const out = result.body;
202+
out["__headers"] = response.headers;
203+
204+
resolve(out);
201205
}
202206
} catch (error) {
203207
reject(error);

0 commit comments

Comments
 (0)