fix: nextjs handler x-fal header passthrough
This commit is contained in:
parent
2e7a4d0a3c
commit
a2166cd113
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@fal-ai/serverless-nextjs",
|
||||
"description": "The fal-serverless Next.js integration",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.2",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@ -71,9 +71,18 @@ export const handler: NextApiHandler = async (request, response) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// pass over headers prefixed with x-fal-*
|
||||
const headers: Record<string, string | string[] | undefined> = {};
|
||||
Object.keys(request.headers).forEach((key) => {
|
||||
if (key.toLowerCase().startsWith('x-fal-')) {
|
||||
headers[key.toLowerCase()] = request.headers[key];
|
||||
}
|
||||
});
|
||||
|
||||
const res = await fetch(targetUrl, {
|
||||
method: request.method,
|
||||
headers: {
|
||||
...headers,
|
||||
authorization: `Key ${falKey}`,
|
||||
accept: 'application/json',
|
||||
'content-type': 'application/json',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user