tatethurston / TwirpScript

A protobuf RPC framework for JavaScript and TypeScript
MIT License
142 stars 13 forks source link

Content-Type key in header is case-sensitive #219

Closed loyddetroz closed 1 year ago

loyddetroz commented 1 year ago

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: https://github.com/tatethurston/TwirpScript/blob/2550b1e40bf6d2b09e372b6ff1fffa3d2db3f81f/packages/twirpscript/src/runtime/server/index.ts#L193

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

tatethurston commented 1 year ago

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.

tatethurston commented 1 year ago

@loyddetroz are you using createTwirpServer or createTwirpServerless?