Open Typraeurion opened 4 months ago
I’ve just encountered another failure which shows the same issue with a leading exclamation point (!
) character. You can force the bug to appear by prepending "!" +
(or "?" +
) to the random value string in the test method.
Expected :{GwjWg3R=[!)!.slU]in|Url(>2], J3WXeb=[!TJu)"m"Y#dc], JZ460KOc=[!91`#I0plxcFYZO|6], dvsSt5g=[!qzOP)GJ7cb], pqKdMh0C=[!:}$$Umw3^]bX:BjfR@], u3K4Z2g=[!hd7hn=4X0`|U]}
Actual :{GwjWg3R=[)!.slU]in|Url(>2], JZ460KOc=[91`#I0plxcFYZO|6], u3K4Z2g=[hd7hn=4X0`|U], dvsSt5g=[qzOP)GJ7cb], J3WXeb=[TJu)"m"Y#dc], pqKdMh0C=[:}$$Umw3^]bX:BjfR@]}
Describe the issue I’m running unit tests which generate random strings for query string parameters. I found that when the parameter value contains a '?' character, the test fails because the reported request is missing this character even though I’ve verified that the URL has properly encoded it as "%3F" (using URIBuilder from Apache httpcore5) and the mock server has received it as shown in the debug log. (The log output from the mock server is included at the bottom.) In this case both
re1kbe
andUgD1t
have values with a leading ‘?’. My test (code shown below) checks the request with a custom method:which seems straightforward enough. In this case, it fails:
The ‘?’ are missing from the “actual” values of the parameters, as returned by the recorded request in the mock server.
What you are trying to do Testing to verify that my code correctly encodes query string parameters with any arbitrary characters.
MockServer version 5.15.0
To Reproduce Steps to reproduce the issue:
How you are running MockServer (i.e maven plugin, docker, etc) In the test class:
Code you used to create expectations
(Due to the random nature of the query parameters, the test needs to be repeated until a ‘?’ shows up somewhere.)
What error you saw
Expected behaviour (Test passes)
MockServer Log