node-fetch/node-fetch

RFC: `Content-Length` on Response should be taken into account?

Open

#879 aperta il 12 giu 2020

Vedi su GitHub
 (8 commenti) (1 reazione) (0 assegnatari)JavaScript (1061 fork)batch import
Node-specificenhancementgood first issue

Metriche repository

Star
 (8563 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

node-fetch currently completely ignoring Content-Length header while consuming response. Fetch specification about handling Content-Length on server response says almost nothing: https://fetch.spec.whatwg.org/#concept-http-network-fetch (see https://github.com/whatwg/fetch/issues/67)

On other hand, we have a fetch-node specific extension to limit the size of the response.

My proposal - analyze and throw early when size for response is specified and Content-Length of response is greater than it.

Guida contributor