Skip to content

make ConstBody and NoBody public #19

Open

Description

@TimPigden

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.

Activity

  1. TimPigden commented on Apr 9, 2020

    @TimPigden
    Author

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions