feat(nextjs): allow auth header override (#12)

* feat(nextjs): allow auth header override

* chore: bump nextjs proxy version to 0.2.3
This commit is contained in:
Daniel Rochetti 2023-10-02 16:06:54 -03:00 committed by GitHub
parent a2166cd113
commit 58520c7553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -11,6 +11,7 @@ export class ApiError extends Error {
public readonly body?: any; public readonly body?: any;
constructor({ message, status, body }: ApiErrorArgs) { constructor({ message, status, body }: ApiErrorArgs) {
super(message); super(message);
this.name = 'ApiError';
this.status = status; this.status = status;
this.body = body; this.body = body;
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "@fal-ai/serverless-nextjs", "name": "@fal-ai/serverless-nextjs",
"description": "The fal-serverless Next.js integration", "description": "The fal-serverless Next.js integration",
"version": "0.2.2", "version": "0.2.3",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -83,7 +83,7 @@ export const handler: NextApiHandler = async (request, response) => {
method: request.method, method: request.method,
headers: { headers: {
...headers, ...headers,
authorization: `Key ${falKey}`, authorization: getHeader(request, 'authorization') ?? `Key ${falKey}`,
accept: 'application/json', accept: 'application/json',
'content-type': 'application/json', 'content-type': 'application/json',
'x-fal-client-proxy': '@fal-ai/serverless-nextjs', 'x-fal-client-proxy': '@fal-ai/serverless-nextjs',