URL Encoding Options NeededDecember 5, 2019 at 6:28pm
I have an API I'm simulating and the device doesn't accept proper URL encoding. If I use a '+' character in the URL route as the device uses in reality, Mockoon gives me a bad response. I agree the '+' in the URL should be encoded, but the device I'm working with won't accept it that way. I'd like to use Mockoon to simulate the device so I can develop the code to retrieve information, but Mockoon is unable to simulate the device.
December 5, 2019 at 8:43pm
December 12, 2019 at 8:45pm
I have a route setup for /vplex/monitor+get-stats . The "+" should be URL encoded as %5B, but the appliance I'm simulating doesn't accept that. When I defined the route in Mockoon as /vplex/monitor%5Bget-stats , it works fine. I use curl on the local machine (windows 10) to verify it's working. I've also done a Wireshark trace and can see the URL in the network traffic and confirmed in has the plus sign in the request. (eliminating any possibility that curl is mangling the request)
December 13, 2019 at 9:46am
There thing is, mockoon routing is based on expressjs which consider the + as an element of a regular expression
So, /a+b will be matched by /aab, /aaab, etc (any number of "a")
I am not sure what the solution is to allow + in route
Maybe detect special character in the request and then url encode, but route would need to be declared encoded I think
Anyway this may need to be tracked in an issue. Feel free to open one on the repository
December 14, 2019 at 1:03am
That should be "backslash" plus in the text. It got filtered. :)
It seems to work with the backslash plus-sign. Thanks. You have saved be some work.
December 14, 2019 at 10:14pm