@hey-api/openapi-ts 0.80.15 → 0.80.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/{chunk-IF5PESMD.js → chunk-X4P65NTE.js} +18 -18
- package/dist/chunk-X4P65NTE.js.map +1 -0
- package/dist/clients/angular/client.ts +12 -11
- package/dist/clients/nuxt/client.ts +6 -1
- package/dist/clients/nuxt/types.ts +1 -0
- package/dist/clients/nuxt/utils.ts +1 -0
- package/dist/index.cjs +181 -181
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +47 -47
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +11 -11
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/{types.d-B_uo8LhA.d.cts → types.d-CFCN8diW.d.cts} +20 -4
- package/dist/{types.d-B_uo8LhA.d.ts → types.d-CFCN8diW.d.ts} +20 -4
- package/package.json +1 -1
- package/dist/chunk-IF5PESMD.js.map +0 -1
|
@@ -65,7 +65,6 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
65
65
|
...options,
|
|
66
66
|
headers: mergeHeaders(_config.headers, options.headers),
|
|
67
67
|
httpClient: options.httpClient ?? _config.httpClient,
|
|
68
|
-
method: 'GET',
|
|
69
68
|
serializedBody: options.body as any,
|
|
70
69
|
};
|
|
71
70
|
|
|
@@ -92,7 +91,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
92
91
|
const url = buildUrl(opts as any);
|
|
93
92
|
|
|
94
93
|
const req = new HttpRequest<unknown>(
|
|
95
|
-
opts.method,
|
|
94
|
+
opts.method ?? 'GET',
|
|
96
95
|
url,
|
|
97
96
|
opts.serializedBody || null,
|
|
98
97
|
{
|
|
@@ -126,26 +125,28 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
127
|
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
const result: {
|
|
129
|
+
request: HttpRequest<unknown>;
|
|
130
|
+
response: any;
|
|
131
|
+
} = {
|
|
131
132
|
request: req,
|
|
132
|
-
response,
|
|
133
|
+
response: null,
|
|
133
134
|
};
|
|
134
135
|
|
|
135
136
|
try {
|
|
136
|
-
response = await firstValueFrom(
|
|
137
|
+
result.response = (await firstValueFrom(
|
|
137
138
|
opts
|
|
138
139
|
.httpClient!.request(req)
|
|
139
140
|
.pipe(filter((event) => event.type === HttpEventType.Response)),
|
|
140
|
-
)
|
|
141
|
+
)) as HttpResponse<unknown>;
|
|
141
142
|
|
|
142
143
|
for (const fn of interceptors.response._fns) {
|
|
143
144
|
if (fn) {
|
|
144
|
-
response = await fn(response, req, opts as any);
|
|
145
|
+
result.response = await fn(result.response, req, opts as any);
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
|
|
148
|
-
let bodyResponse
|
|
149
|
+
let bodyResponse = result.response.body;
|
|
149
150
|
|
|
150
151
|
if (opts.responseValidator) {
|
|
151
152
|
await opts.responseValidator(bodyResponse);
|
|
@@ -160,7 +161,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
160
161
|
: { data: bodyResponse, ...result };
|
|
161
162
|
} catch (error) {
|
|
162
163
|
if (error instanceof HttpErrorResponse) {
|
|
163
|
-
response = error;
|
|
164
|
+
result.response = error;
|
|
164
165
|
}
|
|
165
166
|
|
|
166
167
|
let finalError = error instanceof HttpErrorResponse ? error.error : error;
|
|
@@ -169,7 +170,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
169
170
|
if (fn) {
|
|
170
171
|
finalError = (await fn(
|
|
171
172
|
finalError,
|
|
172
|
-
response as
|
|
173
|
+
result.response as any,
|
|
173
174
|
req,
|
|
174
175
|
opts as any,
|
|
175
176
|
)) as string;
|
|
@@ -65,7 +65,11 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
if (requestValidator) {
|
|
68
|
-
await requestValidator(
|
|
68
|
+
await requestValidator({
|
|
69
|
+
...options,
|
|
70
|
+
// @ts-expect-error
|
|
71
|
+
body: options.rawBody,
|
|
72
|
+
});
|
|
69
73
|
}
|
|
70
74
|
},
|
|
71
75
|
...opts.onRequest,
|
|
@@ -107,6 +111,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
if (composable === 'useFetch' || composable === 'useLazyFetch') {
|
|
114
|
+
opts.rawBody = opts.body;
|
|
110
115
|
const bodyParams = reactive({
|
|
111
116
|
body: opts.body,
|
|
112
117
|
bodySerializer: opts.bodySerializer,
|
|
@@ -72,6 +72,7 @@ export interface RequestOptions<
|
|
|
72
72
|
body?: unknown;
|
|
73
73
|
path?: FetchOptions<unknown>['query'];
|
|
74
74
|
query?: FetchOptions<unknown>['query'];
|
|
75
|
+
rawBody?: unknown;
|
|
75
76
|
}> {
|
|
76
77
|
asyncDataOptions?: AsyncDataOptions<ResT, ResT, KeysOf<ResT>, DefaultT>;
|
|
77
78
|
composable: TComposable;
|
|
@@ -369,6 +369,7 @@ export const executeFetchFn = (
|
|
|
369
369
|
fetchFn: Required<Config>['$fetch'],
|
|
370
370
|
) => {
|
|
371
371
|
const unwrappedOpts = unwrapRefs(opts);
|
|
372
|
+
unwrappedOpts.rawBody = unwrappedOpts.body;
|
|
372
373
|
unwrappedOpts.body = serializeBody(unwrappedOpts);
|
|
373
374
|
return fetchFn(
|
|
374
375
|
buildUrl(opts),
|