play-ws icon indicating copy to clipboard operation
play-ws copied to clipboard

Can't override `Content-Type` once it's set

Open ignasi35 opened this issue 8 years ago • 2 comments

When the body of a request is set the Content-Type header is derived from the actual payload. Once set, the Content-Type can't be overriden.

See https://github.com/playframework/play-ws/commit/b7059c90a504335723c8e7c6621ffece2b792fa1#diff-4314f1bc7ecca562239ccbdaf002c36cR77

This is preventing advanced users from managing the serialization themselves, then provide (e.g.) a ByteString and finally set the the Content-Type manually. That is the case of Lagom.

ignasi35 avatar Jun 26 '17 14:06 ignasi35

This is because withBody also sets the content type, and there were issues with content-type being set out of order.

wsargent avatar Jun 26 '17 17:06 wsargent

So the original rationale was repeated content types:

And then there's been reworking of the logic when handling typed bodies with content types.

wsargent avatar Jun 26 '17 17:06 wsargent