mirror of
https://github.com/better-auth/better-auth.git
synced 2026-10-19 23:53:17 -05:00
fix(expo): construct the new Request to avoid immutable headers error on Cloudflare Workers (#7774)
(cherry picked from commit ecbd1e0b2a)
This commit is contained in:
@@ -35,8 +35,12 @@ export const expo = (options?: ExpoOptions | undefined) => {
|
||||
if (!expoOrigin) {
|
||||
return;
|
||||
}
|
||||
const req = request.clone();
|
||||
req.headers.set("origin", expoOrigin);
|
||||
|
||||
// Construct new Headers with new Request to avoid mutating the original request
|
||||
const newHeaders = new Headers(request.headers);
|
||||
newHeaders.set("origin", expoOrigin);
|
||||
const req = new Request(request, { headers: newHeaders });
|
||||
|
||||
return {
|
||||
request: req,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user