最近更新时间:2023.12.20 19:13:37
首次发布时间:2023.02.15 19:04:51
以下示例展示了如何利用JavaScript的JSON能力在边缘回复JSON数据。
addEventListener("fetch", event => { const data = { hello: "world" } const json = JSON.stringify(data); return event.respondWith( new Response(json, { headers: { "content-type": "application/json;charset=UTF-8" } }) ) })