File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ const functionRegistry: any = {
8686 keys : [ "code" ] ,
8787 handler : UnofficialEndpoints . runCode ,
8888 } ,
89- "/getCurrentFileInfo " : {
89+ "/current_file_info " : {
9090 keys : [ ] ,
9191 handler : getCurrentFileInfo ,
9292 }
@@ -97,6 +97,12 @@ export async function startRpcServer() {
9797 server = http . createServer ( ( req , res ) => {
9898 const parsedUrl = new URL ( req . url ! , `http://${ req . headers . host } ` ) ;
9999 logger . channel ( ) ?. trace ( `request: ${ parsedUrl } ` ) ;
100+
101+ // 添加 CORS 头
102+ res . setHeader ( 'Access-Control-Allow-Origin' , '*' ) ; // 允许所有源,或者指定一个具体的源
103+ res . setHeader ( 'Access-Control-Allow-Methods' , 'GET, POST, OPTIONS' ) ; // 允许的 HTTP 方法
104+ res . setHeader ( 'Access-Control-Allow-Headers' , 'Content-Type' ) ; // 允许的请求头
105+
100106 if ( parsedUrl . pathname === "/favicon.ico" ) {
101107 res . writeHead ( 204 ) ;
102108 res . end ( ) ;
You can’t perform that action at this time.
0 commit comments