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

Request `body` matcher methods need to allow hamcrest matcher for content-type #43

Closed cjstehno closed 7 years ago

cjstehno commented 7 years ago

The Request.body content matcher methods allow for Hamcrest matchers as values, but not for content types. It would be useful (especially in multipart matching) to allow for Hamcrest matchers in the content type fields. So that you could have something like:

expectations {
    post('/foo').body( any(), startsWith('text/') ).responds().code(201)
}
cjstehno commented 7 years ago

The content type is already matched as a starts-with match and it is also used inside of the body content matcher, so this seems like more work than it has value at this point. Shelving for now until there is a real need.