-
If you need to synthesize JSON responses in Service Workers, your life will soon get easier: 🫤 Before:
js new Response(JSON.stringify(object), { headers: { "Content-Type": "application/json" } });
😆 After:
new Response.json(object);
fetch.spec.whatwg.org/#ref-for-dom-response-json -
Correction: since it's a static method: 😆 After (without
new
):Response.json(object);