@@ -5,17 +5,17 @@ import { NextRequest } from "next/server";
55/* -------------------------------------------------------------------- */
66async function proxy ( req : NextRequest , path : string [ ] ) : Promise < Response > {
77 const BASE_URL = process . env . BYTEBOT_AGENT_BASE_URL ! ;
8- const subPath = path . length ? `/ ${ path . join ( "/" ) } ` : "" ;
9- const url = `${ BASE_URL } /api ${ subPath } ${ req . nextUrl . search } ` ;
8+ const subPath = path . length ? path . join ( "/" ) : "" ;
9+ const url = `${ BASE_URL } /${ subPath } ${ req . nextUrl . search } ` ;
1010
1111 // Extract cookies from the incoming request
12- const cookies = req . headers . get ( ' cookie' ) ;
12+ const cookies = req . headers . get ( " cookie" ) ;
1313
1414 const init : RequestInit = {
1515 method : req . method ,
16- headers : {
16+ headers : {
1717 "Content-Type" : "application/json" ,
18- ...( cookies && { " Cookie" : cookies } )
18+ ...( cookies && { Cookie : cookies } ) ,
1919 } ,
2020 body :
2121 req . method === "GET" || req . method === "HEAD"
@@ -31,11 +31,11 @@ async function proxy(req: NextRequest, path: string[]): Promise<Response> {
3131
3232 // Create response headers
3333 const responseHeaders = new Headers ( {
34- "Content-Type" : "application/json"
34+ "Content-Type" : "application/json" ,
3535 } ) ;
3636
3737 // Add Set-Cookie headers if they exist
38- setCookieHeaders . forEach ( cookie => {
38+ setCookieHeaders . forEach ( ( cookie ) => {
3939 responseHeaders . append ( "Set-Cookie" , cookie ) ;
4040 } ) ;
4141
0 commit comments