[whatwg/fetch] static method: `Response.html`? (Issue #1865)

noamr created an issue (whatwg/fetch#1865)

### What problem are you trying to solve?

Making it easier to serve HTML content directly from a service worker.

### What solutions exist today?

This is actually quite easy:

```js
new Response(html, { headers: { "Content-Type": "text/html" } })
```

However not very discoverable and doesn't feel "encouraged".

### How would you solve it?

`Response.html(html_string)`, kind of like `Response.json(json_string)`, can perform the same as the existing solution, but in an ergonomic/"encouraged" way.

### Anything else?

_No response_

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1865
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/1865@github.com>

Received on Monday, 6 October 2025 14:16:02 UTC