tatethurston/TwirpScript

Content-Type key in header is case-sensitive

loyddetroz opened this issue · 2 comments

Minor issue. Right now the content type keyword is being matched to a lower-case key which gives this error upon sending a request:

e.g. in headers in Postman

Content-Type: application/json

{
    "code": "malformed",
    "msg": "no request content-type provided"
}

Narrowed it down to this line:

const contentType = req.headers["content-type"];

Hope you can correct me if I'm wrong or if there was any reasoning for this deliberate choice. :)

Thanks @loyddetroz, happy to make this case insensitive. The HTTP2 spec requires lower case header keys, but TwirpScript should fully support the HTTP 1.x specification.

@loyddetroz are you using createTwirpServer or createTwirpServerless?