Skip to content

Return error when content-length header does not match bytes transferred #1462

@kanongil

Description

@kanongil

What problem are you trying to solve?

Safely retrieve content delivered from a server.

Describe the feature

Depending on how the stream is sent from the server, got will happily complete without error, even if the actual bytes transferred does not match the value in the content-length header.

While it is possible to workaround, and detect manually, it is quite cumbersome, especially if decompress is enabled.

FYI, it is not a problem when the server responds with content-encoding: chunked, since node will error if such a stream is interrupted.

Checklist

  • I have read the documentation and made sure this feature doesn't already exist.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions