http4s/http4s-okhttp-client

okhttp-client: Calling withHeaders after withEntity removes the just set entity

rintcius opened this issue · 1 comments

      Request[IO](Method.POST, uri"https://httpbin.org/post")
        .withEntity("some body")
        .withHeaders(
          org.http4s.headers.`Content-Type`(MediaType.text.plain)
        )

See https://github.com/rintcius/http4s-clients-poc/blob/master/src/test/scala/com/github/rintcius/poc/http4s/client/PostReqsSuite.scala#L68-L80 for repro

Same comment as http4s/http4s-async-http-client#5

withHeaders replaces all headers. putHeaders replaces headers of the same name. (This is a good use of "put" if we think of it like a Map, and a bad use of "put" if we think of it like HTTP.)