Skip to content

[Bug]: Trusted HEAD responses advertise Content-Length 0 for nonempty GET representations #139

Closed

Description

@jimhoyd

Runtime revision and environment

c984d72; Node 26.8.2, macOS arm64.

Minimal reproduction

version: "1"
routes:
  /:
    function: {source: f.mjs}

f.mjs: export default () => new Response('hello').
Run identical GET and HEAD through createRuntime and prepareResponse.

Relevant output

GET produces 5 bytes. HEAD discards the body in src/trusted-functions.ts:145, returns no contentLength, and src/http-response.ts then advertises Content-Length: 0. Expected: HEAD carries the GET representation length (5), or omits Content-Length if unavailable without consuming the stream. It must not invent zero. Preserve no-body delivery, and explicitly cancel/dispose any unused stream. Add wire-level coverage for dynamic and middleware-transformed responses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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