Skip to content

Content-Length header missing on GET but present on HEAD request #163

@call-a3

Description

@call-a3

When trying to request a file (both when using fetch from the browser or via httpie), the Content-Length header is present when performing a HEAD request, but absent when performing a GET request for the same file.

$ npx serve . & # running serve in the folder that contains a file named sizes.csv
$ http get http://localhost:3000/sizes.csv
HTTP/1.1 200 OK
Accept-Ranges: bytes
Connection: keep-alive
Content-Disposition: inline; filename="sizes.csv"
Content-Encoding: gzip
Content-Type: text/csv; charset=utf-8
Date: Tue, 01 Feb 2022 16:41:31 GMT
ETag: "fe6386cd1487ccd8226d4750f395b4bac29a9465"
Keep-Alive: timeout=5
Transfer-Encoding: chunked
Vary: Accept-Encoding

^C # aborted because I didn't want to download the actual file in this test
$ http head http://localhost:3000/sizes.csv
HTTP/1.1 200 OK
Accept-Ranges: bytes
Connection: keep-alive
Content-Disposition: inline; filename="sizes.csv"
Content-Length: 920509727
Content-Type: text/csv; charset=utf-8
Date: Tue, 01 Feb 2022 16:41:38 GMT
ETag: "fe6386cd1487ccd8226d4750f395b4bac29a9465"
Keep-Alive: timeout=5
Vary: Accept-Encoding

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions