Skip to content

Commit ef329e3

Browse files
brolnickijmrlubos
authored andcommitted
chore(client-ofetch): bump snapshots
1 parent f8cb3fd commit ef329e3

File tree

30 files changed

+130
-30
lines changed

30 files changed

+130
-30
lines changed

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/base-url-false/client/client.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const createClient = (config: Config = {}): Client => {
8484
opts.body !== undefined &&
8585
opts.bodySerializer === null &&
8686
(opts.headers.get('Content-Type') || '').toLowerCase() ===
87-
'application/json'
87+
'application/json'
8888
) {
8989
const b: unknown = opts.body;
9090
if (typeof FormData !== 'undefined' && b instanceof FormData) {

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/base-url-false/client/types.gen.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ export interface Config<T extends ClientOptions = ClientOptions>
4141
* @default globalThis.fetch
4242
*/
4343
fetch?: typeof fetch;
44+
/**
45+
* Controls the native ofetch behaviour that throws `FetchError` when
46+
* `response.ok === false`. We default to suppressing it to match the fetch
47+
* client semantics and let `throwOnError` drive the outcome.
48+
*/
49+
ignoreResponseError?: OfetchOptions['ignoreResponseError'];
4450
// No custom fetch option: provide custom instance via `ofetch` instead
4551
/**
4652
* Please don't use the Fetch client for Next.js applications. The `next`

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/base-url-false/client/utils.gen.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@ export const buildOfetchOptions = (
324324
body,
325325
dispatcher: opts.dispatcher as OfetchOptions['dispatcher'],
326326
headers: opts.headers as Headers,
327+
ignoreResponseError:
328+
(opts.ignoreResponseError as OfetchOptions['ignoreResponseError']) ??
329+
true,
327330
method: opts.method,
328331
onRequest: opts.onRequest as OfetchOptions['onRequest'],
329332
onRequestError: opts.onRequestError as OfetchOptions['onRequestError'],
@@ -378,9 +381,9 @@ export const parseSuccess = async (
378381
}
379382
}
380383

381-
// Prefer ofetch-populated data
384+
// Prefer ofetch-populated data unless we explicitly need raw `formData`
382385
let data: unknown = (response as any)._data;
383-
if (typeof data === 'undefined') {
386+
if (inferredParseAs === 'formData' || typeof data === 'undefined') {
384387
switch (inferredParseAs) {
385388
case 'arrayBuffer':
386389
case 'blob':
@@ -532,6 +535,7 @@ export const createConfig = <T extends ClientOptions = ClientOptions>(
532535
): Config<Omit<ClientOptions, keyof T> & T> => ({
533536
...jsonBodySerializer,
534537
headers: defaultHeaders,
538+
ignoreResponseError: true,
535539
parseAs: 'auto',
536540
querySerializer: defaultQuerySerializer,
537541
...override,

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/base-url-number/client/client.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const createClient = (config: Config = {}): Client => {
8484
opts.body !== undefined &&
8585
opts.bodySerializer === null &&
8686
(opts.headers.get('Content-Type') || '').toLowerCase() ===
87-
'application/json'
87+
'application/json'
8888
) {
8989
const b: unknown = opts.body;
9090
if (typeof FormData !== 'undefined' && b instanceof FormData) {

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/base-url-number/client/types.gen.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ export interface Config<T extends ClientOptions = ClientOptions>
4141
* @default globalThis.fetch
4242
*/
4343
fetch?: typeof fetch;
44+
/**
45+
* Controls the native ofetch behaviour that throws `FetchError` when
46+
* `response.ok === false`. We default to suppressing it to match the fetch
47+
* client semantics and let `throwOnError` drive the outcome.
48+
*/
49+
ignoreResponseError?: OfetchOptions['ignoreResponseError'];
4450
// No custom fetch option: provide custom instance via `ofetch` instead
4551
/**
4652
* Please don't use the Fetch client for Next.js applications. The `next`

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/base-url-number/client/utils.gen.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@ export const buildOfetchOptions = (
324324
body,
325325
dispatcher: opts.dispatcher as OfetchOptions['dispatcher'],
326326
headers: opts.headers as Headers,
327+
ignoreResponseError:
328+
(opts.ignoreResponseError as OfetchOptions['ignoreResponseError']) ??
329+
true,
327330
method: opts.method,
328331
onRequest: opts.onRequest as OfetchOptions['onRequest'],
329332
onRequestError: opts.onRequestError as OfetchOptions['onRequestError'],
@@ -378,9 +381,9 @@ export const parseSuccess = async (
378381
}
379382
}
380383

381-
// Prefer ofetch-populated data
384+
// Prefer ofetch-populated data unless we explicitly need raw `formData`
382385
let data: unknown = (response as any)._data;
383-
if (typeof data === 'undefined') {
386+
if (inferredParseAs === 'formData' || typeof data === 'undefined') {
384387
switch (inferredParseAs) {
385388
case 'arrayBuffer':
386389
case 'blob':
@@ -532,6 +535,7 @@ export const createConfig = <T extends ClientOptions = ClientOptions>(
532535
): Config<Omit<ClientOptions, keyof T> & T> => ({
533536
...jsonBodySerializer,
534537
headers: defaultHeaders,
538+
ignoreResponseError: true,
535539
parseAs: 'auto',
536540
querySerializer: defaultQuerySerializer,
537541
...override,

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/base-url-strict/client/client.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const createClient = (config: Config = {}): Client => {
8484
opts.body !== undefined &&
8585
opts.bodySerializer === null &&
8686
(opts.headers.get('Content-Type') || '').toLowerCase() ===
87-
'application/json'
87+
'application/json'
8888
) {
8989
const b: unknown = opts.body;
9090
if (typeof FormData !== 'undefined' && b instanceof FormData) {

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/base-url-strict/client/types.gen.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ export interface Config<T extends ClientOptions = ClientOptions>
4141
* @default globalThis.fetch
4242
*/
4343
fetch?: typeof fetch;
44+
/**
45+
* Controls the native ofetch behaviour that throws `FetchError` when
46+
* `response.ok === false`. We default to suppressing it to match the fetch
47+
* client semantics and let `throwOnError` drive the outcome.
48+
*/
49+
ignoreResponseError?: OfetchOptions['ignoreResponseError'];
4450
// No custom fetch option: provide custom instance via `ofetch` instead
4551
/**
4652
* Please don't use the Fetch client for Next.js applications. The `next`

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/base-url-strict/client/utils.gen.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@ export const buildOfetchOptions = (
324324
body,
325325
dispatcher: opts.dispatcher as OfetchOptions['dispatcher'],
326326
headers: opts.headers as Headers,
327+
ignoreResponseError:
328+
(opts.ignoreResponseError as OfetchOptions['ignoreResponseError']) ??
329+
true,
327330
method: opts.method,
328331
onRequest: opts.onRequest as OfetchOptions['onRequest'],
329332
onRequestError: opts.onRequestError as OfetchOptions['onRequestError'],
@@ -378,9 +381,9 @@ export const parseSuccess = async (
378381
}
379382
}
380383

381-
// Prefer ofetch-populated data
384+
// Prefer ofetch-populated data unless we explicitly need raw `formData`
382385
let data: unknown = (response as any)._data;
383-
if (typeof data === 'undefined') {
386+
if (inferredParseAs === 'formData' || typeof data === 'undefined') {
384387
switch (inferredParseAs) {
385388
case 'arrayBuffer':
386389
case 'blob':
@@ -532,6 +535,7 @@ export const createConfig = <T extends ClientOptions = ClientOptions>(
532535
): Config<Omit<ClientOptions, keyof T> & T> => ({
533536
...jsonBodySerializer,
534537
headers: defaultHeaders,
538+
ignoreResponseError: true,
535539
parseAs: 'auto',
536540
querySerializer: defaultQuerySerializer,
537541
...override,

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-ofetch/base-url-string/client/client.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const createClient = (config: Config = {}): Client => {
8484
opts.body !== undefined &&
8585
opts.bodySerializer === null &&
8686
(opts.headers.get('Content-Type') || '').toLowerCase() ===
87-
'application/json'
87+
'application/json'
8888
) {
8989
const b: unknown = opts.body;
9090
if (typeof FormData !== 'undefined' && b instanceof FormData) {

0 commit comments

Comments
 (0)