Re: [whatwg/fetch] Streaming upload (Issue #1438)

It seems like it's also not supported on Safari and getting the error "Error sending request: ReadableStream uploading is not supported".

The following check doesn't seem to work for Safari, how are your app doing the check against Safari browser?
> Not sure if a lot of people use this pattern, but our app was using this code to check if streaming upload is enabled, and it broke for users using browsers based on 105 beta of chromium:
> 
> ```ts
>   public static doesSupportStreamBody (): boolean {
>     // This works because the browser adds a Content-Type header of text/plain;charset=UTF-8 to the request 
>     // if the body is text. 
>     // The browser only treats the body as text if it doesn't support request streams, 
>     // otherwise it won't add a Content-Type header at all.
>     return ReadableStream && !new Request('', {
>         body: new ReadableStream(),
>         method: 'POST',
>       }).headers.has('Content-Type')
>   }
> ```
> 
> We had to add this to fix it:
> 
> ```ts
>         // @ts-expect-error
>         duplex: 'half',
> ```



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

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

Received on Monday, 11 September 2023 21:11:19 UTC