Use of ExpectationForwardAndResponseCallback with forward.
(This might a documentation issue rather than a bug)
I'm trying to run a mockserver as a proxy that handles JOSE then fowards the clear payload, then encrypts the response. But I don't understand how to define both a foward (the destination) and a callback at the same time, as this appears to be invalid:
{ "id": "1", "httpRequest": { "path": "" }, "httpForward": { "host": "127.0.0.1", "port": 6082, "scheme": "HTTP" }, "httpForwardClassCallback": {"callbackClass": "my.package.MyCallback"} }
Since you can only define a "httpForward" or a "httpForwardClassCallback" but not both. If I only define "httpForwardClassCallback" how do I tell it where to go? Is there something to set in the HttpRequest object during the callback?
The example using the ExpectationForwardAndResponseCallback class doesn't explain this either, or ExpectationForwardCallback for that matter.
I've also tried adding two Expectations, but only the first one added is invoked.
Does anyone have any examples of how to use these?
MockServer Version: 5.13.1 (latest shaded version available on corporate repo). I cannot access the public Maven.
Hello. You will have to combine from two examples. First this is how to modify a request to send it somewhere else. You have to plug this in the request handler of either:
- Class callback example - specifically ExpectationForwardAndResponseCallback (listed below the example)
- Closure callback example
And you would have to encrypt the response in the response handler.