As discussed in #35762, HttpEntity currently makes HttpHeaders read-only as part of its constructors. This means that once instantiated, a ResponseEntity cannot mutate its headers anymore.

While immutability is an interesting design principle, here we shouldn't enforce headers as read-only.

Comment From: MrAhmadHassan

Hi @bclozel , I’d like to take up this issue and work on a fix. Could you please assign #35888 to me if it’s still available?

Let me know if there are any specific guidelines or expectations before I begin. Thanks!

Comment From: bclozel

No thanks @MrAhmadHassan it's already assigned. Feel free to keep an eye on the "ideal for contribution tag".