Skip to content

HttpResponseHeader and empty reason #14

@eikek

Description

@eikek

Hi,
I wrote a little http server using fs2-http and then a client to consume this service with fs2-http, too. But the client failed to parse the response generated from my fs2-http endpoint. The problem was, that I was too lazy to think about the reason line in the http status line and put an empty string in it:

HttpResponse(
      HttpResponseHeader(
        status = status,
        reason = "",
        headers = Nil),
      Stream.empty
    )

Most other http parsers I used with this endpoint (like browsers and Elm http) parsed the response without problems, but the HttpResponseHeaderCodec expects a reason after the status code. Once I used reason = status.label in the above snippet, my problems were solved. But it took a while to figure that out :-)

So my question is, whether we can improve the api in that it either is not possible to specify an empty reason or it I would also be fine with throwing an exception. Or make the reason line optional in the response parser? (I'm not sure about the exact spec here)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions