feat: Handle OPTIONS requests for CORS support
- Add handling for OPTIONS requests in RPC server - Return 200 status with JSON response for OPTIONS - Update diffApply function keys to include "autoedit"
This commit is contained in:
parent
f9131447c5
commit
6e72521142
@ -59,7 +59,7 @@ const functionRegistry: any = {
|
|||||||
handler: () => "vscode",
|
handler: () => "vscode",
|
||||||
},
|
},
|
||||||
"/diff_apply": {
|
"/diff_apply": {
|
||||||
keys: ["filepath", "content"],
|
keys: ["filepath", "content", "autoedit"],
|
||||||
handler: UnofficialEndpoints.diffApply,
|
handler: UnofficialEndpoints.diffApply,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -126,6 +126,12 @@ export async function startRpcServer() {
|
|||||||
|
|
||||||
let params: any = {};
|
let params: any = {};
|
||||||
|
|
||||||
|
if (req.method === 'OPTIONS') {
|
||||||
|
res.writeHead(200, { "Content-Type": "application/json" });
|
||||||
|
res.end(JSON.stringify({"status": "ok"}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (req.method === "POST") {
|
if (req.method === "POST") {
|
||||||
let body = "";
|
let body = "";
|
||||||
req.on("data", (chunk) => {
|
req.on("data", (chunk) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user