Closed
Description
I know there is a preprocessor to remove the header. But I could not find a preprocessor that could add or modify headers. How about providing a preprocessor that supports add, set, and remove headers like a modifyParameters
on Preprocessors
? If you do not mind, I want PR.
For example, it might be useful in the following case:
@Test
public void test() throws Exception {
this.mockMvc
.perform(get("/test").header("Authorization", "Basic dXNlcjpzZWNyZXQ="))
.andExpect(status().isOk())
.andDo(document("test"));
}
Below is one of the generated .adoc
files by the test code.
http-request.adoc
[source,http,options="nowrap"]
----
GET /test HTTP/1.1
Host: localhost:8080
Authorization: Basic dXNlcjpzZWNyZXQ=
----
The value of the Authorization
header must be valid to pass the test. But, documents should not expose valid Authorization
header value. In this case, I want to modify the value of the Authorization
header to an invalid value through preprocessor.