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

Raw request handling #36

Closed cjstehno closed 7 years ago

cjstehno commented 7 years ago

It might be useful to add a means of writing a matcher directly against a request, something like:

server.expectations {
    match( matcher ).responds().body('ok', TEXT_PLAIN)
}

where matcher would be a hamcrest matcher given the ClientRequest object to match against. This would allow another level of flexibility in match configuration.

Note: that the match method would be generic to handle whatever the matcher matches, including the request method.

cjstehno commented 7 years ago

While an interesting idea, this is not really needed and would require a major change of the expectation definition architecture. Killing this for now.