Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa committed Mar 29, 2023
1 parent 447dec9 commit cd97995
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function middleware(req: NextRequest) {
// inject api key
if (!token) {
const apiKey = process.env.OPENAI_API_KEY;
console.log("apiKey", apiKey);
if (apiKey) {
req.headers.set("token", apiKey);
} else {
Expand All @@ -46,5 +47,9 @@ export function middleware(req: NextRequest) {
}
}

return NextResponse.next();
return NextResponse.next({
request: {
headers: req.headers,
},
});
}

0 comments on commit cd97995

Please sign in to comment.