Using MockMVC in tests and I need to test a GET URL that is already URL encoded:
http://host:port/app/controller/[ALREADY URL ENCODED]
The code:
mockmvc.perform(get("/controller/[ALREADY URL ENCODED]")
However in the logs I see that the URL has been url encoded again before it gets to the appropriate controller method. Is there a way that we can prevent spring mockmvc to url encode? Perhaps disable url encoding in the test?
Real example of the "[ALREADY URL ENCODED]" string:
MEUwQzBBMD8wPTAJBgUrDgMCGgUABBQ%2Fm36Fj2BE19VBYXRO62zrgIYp0gQVAQazEyvlq22wsMBkRyAeaUiZ%2BhTUAgMGJbQ%3D
This gets URL encoded again before the controller sees it.
This is from the logs (the string has been url encoded again)
xxxxx [main] DEBUG [o.s.t.w.s.TestDispatcherServlet] DispatcherServlet with name '' processing GET request for [/app/controller/MEUwQzBBMD8wPTAJBgUrDgMCGgUABBQ%252Fm36Fj2BE19VBYXRO62zrgIYp0gQVAQazEyvlq22wsMBkRyAeaUiZ%252BhTUAgMGJbQ%253D]
Note that if I invoke using CURL then there is no url encoding performed by the spring framework and the controller gets what is sent across. However mockmvc would do the encoding before it gets to the appropriate controller method.
curl -X GET http:host:port/app/controller/[ALREADY URL ENCODED]
Thanks.