Skip to content

HTTP2: API for checking if http2ServerRequest had body frame. #22497

Closed
@sogaani

Description

@sogaani

Is your feature request related to a problem? Please describe.
Some express middleware check if httpRequest has/had body. e.g body-parser.
And it depends on content-length header.
Although a http request with body in http/1 must contain content-length header, http2 request with body can have no content-length header.
We can use http2ServerRequest.stream.readable only before readable stream ended to check if request might have body frame. I'm not sure how to check it after readable stream ended with current http2 compatibility APIs.

Describe the solution you'd like
I'd like to add new API to check if request had body, or readable stream had been read data after readable stream ended.

Describe alternatives you've considered
I notice that http2ServerRequest.stream._readableState.sync can be used. However we should not use _readableState.

Metadata

Metadata

Assignees

No one assigned

    Labels

    http2Issues or PRs related to the http2 subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions