Skip to content

Commit

Permalink
client: Fix cors credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Jan 12, 2024
1 parent dff05e7 commit a06e786
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/src/fetch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export interface HttpFetchOptionsBase<B> {
withCredentials?: boolean;
}

export interface HttpFetchJsonOptions<B> extends HttpFetchOptionsBase< B> {
export interface HttpFetchJsonOptions<B> extends HttpFetchOptionsBase<B> {
responseType: 'json';
}

export interface HttpFetchBufferOptions<B> extends HttpFetchOptionsBase< B> {
export interface HttpFetchBufferOptions<B> extends HttpFetchOptionsBase<B> {
responseType: 'buffer';
}

Expand Down Expand Up @@ -126,6 +126,7 @@ export async function domFetch<T extends HttpFetchOptions<BodyInit>>(options: T)
const { url } = options;
const response = await fetch(url, {
method: getFetchMethod(options),
credentials: options.withCredentials ? 'include' : undefined,
headers,
signal: options.timeout ? AbortSignal.timeout(options.timeout) : undefined,
body,
Expand Down

0 comments on commit a06e786

Please sign in to comment.