Skip to content

Commit

Permalink
fix(proxy): transparently forward errors when passing ofetch (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aareksio authored Jul 27, 2023
1 parent 091b61c commit 9bd85a3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export type Duplex = "half" | "full";

export interface ProxyOptions {
headers?: RequestHeaders | HeadersInit;
fetchOptions?: RequestInit & { duplex?: Duplex };
fetchOptions?: RequestInit & { duplex?: Duplex } & {
ignoreResponseError?: boolean;
};
fetch?: typeof fetch;
sendStream?: boolean;
streamRequest?: boolean;
Expand Down Expand Up @@ -76,6 +78,7 @@ export async function sendProxy(
) {
const response = await _getFetch(opts.fetch)(target, {
headers: opts.headers as HeadersInit,
ignoreResponseError: true, // make $ofetch.raw transparent
...opts.fetchOptions,
});
event.node.res.statusCode = sanitizeStatusCode(
Expand Down

0 comments on commit 9bd85a3

Please sign in to comment.