Skip to content

Commit

Permalink
feat: add .redirect to RequestOptions and support in fetch engine
Browse files Browse the repository at this point in the history
  • Loading branch information
kormanowsky committed Nov 6, 2024
1 parent 84e3818 commit 56a5da7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/request/engines/fetch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,18 @@ const request: RequestEngine = (params) => {
credentials = 'include';
}

let
redirect: RequestRedirect = 'follow';

if (Object.isString(p.redirect)) {
redirect = p.redirect;
}

const fetchOpts: RequestInit = {
body,
headers,
credentials,
redirect,
method: p.method,
signal: abortController.signal
};
Expand Down
1 change: 1 addition & 0 deletions src/core/request/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ export interface RequestOptions {

readonly important?: boolean;
readonly credentials?: boolean | RequestCredentials;
readonly redirect?: RequestRedirect;
}

/**
Expand Down

0 comments on commit 56a5da7

Please sign in to comment.