-
Notifications
You must be signed in to change notification settings - Fork 739
Description
I have an application with a simple zuul route that forwards to another service.
I've setup a RestDoc test to invoke the routed path with a POST and content.
mockMvc.perform(
post("/ivr/auth/brand/{brand}/protocol/openid-connect/token", "mybrand")
.contextPath("/ivr")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.content("grant_type=client_credentials&client_id=democlient&client_secret=43310292-83d4-44f4-9b47-6536f0d6f6f6"))
.andExpect(
status().isOk())
.andDo(document("authentication-token-example")
That results in the request being successfully served, but the generated curl-request.adoc and request-fields.adoc having the body documented correctly but it incorrectly appends the parameters onto the query string.
[source,bash]
----
$ curl 'https://localhost:8080/ivr/auth/brand/mybrand/protocol/openid-connect/token?grant_type=client_credentials&client_id=democlient&client_secret=43310292-83d4-44f4-9b47-6536f0d6f6f6' -i -X POST \
-H 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' \
-d 'grant_type=client_credentials&client_id=democlient&client_secret=43310292-83d4-44f4-9b47-6536f0d6f6f6'
----
When I try to use the perform().param() syntax to provide the form data instead of the .perform.content() then my request fails as there seems to be some incompatibility with the way that the org.springframework.cloud.netflix.zuul.filters.pre.FormBodyWrapperFilter interacts with a org.springframework.mock.web.MockHttpServletRequest
Any ideas on how I can get the generated snippets for the request to not add the form parameters as query string parameters?