Skip to content
Prev Previous commit
Next Next commit
test: add test for redirect
  • Loading branch information
wolfy1339 committed Apr 9, 2024
commit fc9bd43e7bcb7bf03ae94833728da4c8dd950200
14 changes: 14 additions & 0 deletions test/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1107,4 +1107,18 @@ x//0u+zd/R/QRUzLOw4N72/Hu+UG6MNt5iDZFCtapRaKt6OvSBwy8w==
expect(mock.done()).toBe(true);
});
});

it("request should pass the `redirect` option to fetch", () => {
const customFetch = async (url: string, options: RequestInit) => {
expect(options.redirect).toEqual("manual");
return await fetch(url, options);
};

return request("/", {
request: {
redirect: "manual",
fetch: customFetch
},
});
});
});