@lucia-auth/nextjs
Version:
Lucia integration for Next.js
16 lines (15 loc) • 509 B
JavaScript
export const convertNextRequestToStandardRequest = (req) => {
const url = `${process.env.NODE_ENV === "production" ? "https" : "http"}://${req.headers.host}${req.url}`;
return {
headers: {
get: (name) => {
const value = req.headers[name.toLocaleLowerCase()] || null;
if (Array.isArray(value))
return value.toString();
return value;
}
},
url,
method: req.method || ""
};
};