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

Support for proxy #54

Closed cjstehno closed 7 years ago

cjstehno commented 7 years ago

TBD

cjstehno commented 7 years ago

Undertow has built in proxy support as a handler and various clients. This would require the proxy to be configured at server start, so probably need to investigate using the client part as part of the expectation chain - either off of response or as a separate branch off of request.

Seems that this way would allow proxying specific requests and treating other as normal.

Is there anything useful to do with proxy other than just pass the request and response through it?

cjstehno commented 7 years ago

Add support for path wildcard string '*' (ends up as any path matcher)

expectations {
    get('/other').proxy('http://something.else/another')
}
expectations {
    any('*').proxy(...)
}

proxy is similar to response branching point

A second erasatz server could be setup to handle the proxied requests:

expectations {
    get('/another').responds(...)
}

or the 'proxy' could re-route to the same server, just a different path

middleman.expectations {
    get('/alpha').proxy('/bravo')
    get('/bravo').responds(...)
}

This allows number of servers to be minimized

cjstehno commented 7 years ago

This is not needed. Closing.