tomayac’s avatartomayac’s Twitter Archive—№ 20,667

    1. 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
  1. …in reply to @tomayac
    Correction: since it's a static method: 😆 After (without new): Response.json(object);