I am trying to test a secure REST method, using Spring MVC Test Framework.
val result = this.mockMvc!!
.perform(get("/ping").with(SecurityMockMvcRequestPostProcessors.user("user")))
.andDo(MockMvcResultHandlers.print())
.andReturn()
assertThat(result.response.contentAsString).contains("pong")
The problem is that on this request, the mocked server is responding a 302 code, to redirect to a secure channel. The result is never 2xx
code, is always a 302
code. I would like to follow this redirect, or perform the request on secure channel at the first time.
How can I perform this test to do directly on a mocked secure channel?