Re: [whatwg/fetch] Feature detecting streaming requests (Issue #1470)

Nah, that's true in Safari.

The main problem here is that Safari supports requests with stream bodies, but it rejects when they're passed to fetch. Here was the old feature detect I used to work around the Safari issue:

```js
const supportsRequestStreamsP = (async () => {
  const supportsStreamsInRequestObjects = !new Request('', {
    body: new ReadableStream(),
    method: 'POST',
  }).headers.has('Content-Type');

  if (!supportsStreamsInRequestObjects) return false;

  return fetch('data:a/a;charset=utf-8,', {
    method: 'POST',
    body: new ReadableStream(),
  }).then(() => true, () => false);
})();

// Note: supportsRequestStreamsP is a promise.
if (await supportsRequestStreamsP) {
  // …
} else {
  // …
}
```

…but I'm hoping we won't have to do that now we have `duplex`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1470#issuecomment-1181751952

You are receiving this because you are subscribed to this thread.

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

Received on Tuesday, 12 July 2022 13:20:21 UTC