playframework / playframework/play-ws

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

Open
#158 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:backlog
Dominant language
Scala
Stars
224
Forks
92
Avg merge
1d 19h
Merged PRs (30d)
28

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the referenced play-ws commit and the Content-Type handling used by Lagom's ClientServiceCallInvoker.scala. Trace how a request body and manually supplied header are processed, then verify that a ByteString payload can retain an explicitly set Content-Type.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.