Javascript `fetch`-API, how to use http-header `Range` without `If-Range`

Viewed 189

Javascript Code:

const resp = await fetch(path, {
    headers: {
      'range': `bytes=${from}-${to}`
    },
    cache: 'force-cache'
  });

Chrome adds the If-Range header (sometimes):

If-Range: "76648e655156d81:0"
Range: bytes=434176-438271

The If-Range HTTP request header makes a range request conditional: if the condition is fulfilled, the range request is issued, and the server sends back a 206 Partial Content answer with the appropriate body. If the condition is not fulfilled, the full resource is sent back with a 200 OK status.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Range

This behaviour is very problematic for me.

How can I ensure a "Partial Content" ? Or how can I remove this If-Range-Header?

0 Answers
Related