[whatwg/fetch] Add size limiter to `Body#formData` method (Issue #1592)

Right now there is no way to call `Body#formData` on arbitrary user input without potentially causing an OOM. It would be great if we could constrain the `formData` parser so it stops parsing if a body exceeds a certain size.

Example API:

```js
const form = req.formData({ maxSize: 10_000_000 /* 10MB */ })
```

If the body size exceeds the max size, a `QuotaExceededError` `DOMException` should be thrown.

This might make sense for `.text()`, `.blob()`, `.arrayBuffer()`, and `.json()` also.

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

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

Received on Thursday, 12 January 2023 21:34:33 UTC