uzhttp
uzhttp copied to clipboard
make ConstBody and NoBody public
I'm trying to adapt some code from http4s. One of the things I do there is write tests which generate a request object that gets compared to the routes and processed using my backend returning a Response object. The test can be run without firing up the server and worrying about actual http stuff going over the wire. http4s promotes this technique for unit testing.
But here all the concrete classes (except websockets) are private. So I have to have my own concrete version of Request (I copy NoBody and ConstBody) to create requests.
That's doable, though inconvenient. The worse problem is that I can't get at the body of a response at all, since there is no method on Response and the concrete classes are all private with private constructors.
In effect, I have rendered untestable all the stuff involved with content headers, formatting and so on, unless my unit tests actually instantiate a server and a client explicitly.
PS happy to do a PR or whatever, but this seems way too intrusive a change to not have the author's say-so or input