This PR fixes a bug in org.springframework.http.HttpHeaders
class.
It was not possible to delete/clear the Host
header before this fix.
This bug was first introduced in this commit (in 2018): https://github.com/spring-projects/spring-framework/commit/5bbbc82e19e4c2ed443ce955949137ec8c0a2e02#diff-e2d6218e6585f8b7e32682f6f8f7aed22dbd76d862ec92e86e0902243889556aR1020
After that commit, the deletion logic line in setHost()
method started to look like this: remove(HOST, null)
Although for all other methods/headers it looks like this: remove(CONTENT_TYPE)
, remove(ETAG)
, etc.
And for setHost()
method it also should be the same: remove(HOST)
I've also added a test for this case. Feel free to rollback my 1-line fix in HttpHeaders
and check that Host
header is not cleared indeed.
Comment From: pivotal-cla
@bivo Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
Comment From: pivotal-cla
@bivo Thank you for signing the Contributor License Agreement!