Skip to content

Commit dc725b4

Browse files
committed
support CORS in RPC
1 parent 0ea99d2 commit dc725b4

File tree

1 file changed

+7
-1
lines changed
  • packages/nitro-rpc-client/src/transport

1 file changed

+7
-1
lines changed

packages/nitro-rpc-client/src/transport/http.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ export class HttpTransport {
3636
): Promise<unknown> {
3737
const url = new URL(`http://${this.server}`).toString();
3838

39-
const result = await axios.post(url.toString(), JSON.stringify(req));
39+
const result = await axios.post(url.toString(), JSON.stringify(req), {
40+
headers: {
41+
"Access-Control-Allow-Origin": "*",
42+
"Access-Control-Allow-Headers": "*",
43+
"Access-Control-Expose-Headers": "*",
44+
},
45+
});
4046

4147
return result.data;
4248
}

0 commit comments

Comments
 (0)