by tizzy · 3y ago · 0 comments
What was your solution to this? Parse the things the library didn't?
In my view it's a very bad design for an http library, although it would have been a lot less frustrating if it had at least provided an escape hatch.
I typically design code around things like this with a sum type like:
data Header = KnownHeader1 | KnownHeader2 | UnknownHeader String String
Then I typically don't offer any extra support or extended functionality for the cases where the type is `UnknownHeader`.Which I agree, is a poor design choice. A type modeling an HTTP request should model the RFC definition as closely as possible.
I couldn't disagree more. A type modeling an HTTP request should model HTTP requests. Not some theoretical description of an HTTP request.