Skip to content

Latest v1.17.1 update breaks ExpressJS req.get #320

@jayschwane

Description

@jayschwane

Context

Express v5 (source) and v4 (source) request objects have a get method - a case-insensitive way to get a request header. req.get is a widely used method for safely getting request headers.

Issue

As of v1.17.1 I have failing unit tests with:

TypeError: mockRequest.headers.get is not a function

Previous version v1.17.0 did not exhibit this issue. In v1.17.0, mockRequest.getHeader was a standalone method (did not call mockRequest.headers.get).

As of v1.17.1, mockRequest.getHeader was refactored to call mockRequest.headers.get (source). As far as I can tell, objects returned from createHeaders should have get methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions