Forward to Another Service

In some cases, we may need to forward all or some of the requests to a real backend somewhere outside of MockMotor.

It may be required for:

  • Adding a new response before it is actually ready on the real backend
  • Replacing some of the real responses with mocked ones to test special scenarios
  • Recording the traffic in the execution log for later mocking
  • The forwarding is not performed on mock service level. Instead, each of responses can be configured separately to forward its request, or to respond with a mock. Different responses can even be forwarded to different services, if required.

    Forward URL

    To forward a response, simply provide the forward URL:

    No other values are required. The HTTP request will be forwarded to the backend as-is, including all the HTTP headers except those that can be different for MockMotor-backend communications. Currently, MockMotor replaces Host, Connection, User-Agent, Content-Length and Accept-Encoding headers.


    The response cannot modify the response received from the backend (for example, to add a field to mock a future update). This is planned for some of the future versions.

    Forwarding to backends with two-way SSL is not yet supported - MockMotor cannot yet present a trusted certificate.

    Forward & Record the Response

    When the Record Response As Mock is enabled, the response from the forward is not only sent back to the consumer but also recorded as a fully configured mock response.

    The newly created mock is placed below the forwarding mock. This is to make sure the new mock doesn’t break the current test flow. When the flow is completed, you need to move the recorded mock to its proper place in the list manually.

    The recorded mock uses as many of the request parameters as possible to provide the exact match:

  • SOAP Action or First Element Name
  • Relative URI
  • Names and values of segments in the URI
  • Names and values of query parameters
  • The mock also saves the response values:

  • Response HTTP Status
  • Response payload
  • Response time as a delay
  • Content-Type