MockHttpServletRequest supports adding arbitrary headers, but subsequent calls to addHeader always append the new values. While the internal doAddHeaderValue takes a boolean to specify replacement, it's not visible externally. When using the class for testing, it is often useful to construct it with the usual headers in a setup method, but there's no way to then overwrite a header per-test.
It would be useful to be able to remove an existing header from the request (either to leave it missing or to then replace it with a new value).
#21828 Support for removeHeader in MockHttpServletRequest
The text was updated successfully, but these errors were encountered: