cjstehno / ersatz

🤖 A simulated HTTP server for testing client code with configurable responses.
https://cjstehno.github.io/ersatz
Apache License 2.0
47 stars 5 forks source link

form parameters' matcher #88

Closed musketyr closed 6 years ago

musketyr commented 6 years ago

If form parameters are sent using the POST request it would be great if there is a built-in method on request to match these parameters similar to query

post('/form') {
    param 'foo', contains(containsString('bar'))
} 
cjstehno commented 6 years ago

Not a bad idea. I will have to see how much work this would be to implement.

musketyr commented 6 years ago

you can use the following decoder snippet to get the parameters out of the body:

QueryParameterUtils.parseQueryString(new String(body, 'UTF-8'), 'UTF-8')
cjstehno commented 6 years ago

This has been implemented and will be in the 1.7.0 release.