- Mocks integrated systems via HTTP or HTTPS:
- Configure it to return specific responses for different requests.
- Can be used as a proxy to record and optionally modify requests and responses.
- Can be both of the previous ones.
With MockServer we can:
- Return a mock response when a request matches an expectation.
- Forward a request when the request matches an expectation.
- Execute a callback when a request matches an expectation (dynamic mocked response).
- Return an invalid response or close the connection when a request matches an expectation.
- Verify requests have been sent.
- Retrieve logs, requests or expectations to help debug.
We are doing this for integration and e2e tests.
Important
HTTP client should send requests to the MockServer. Not the actual service.
- Here by "HTTP client" we mean things like another microservice api.
You can see logs, active expectations, requests received, proxied requests in the dashboard. Open this address in your browser: localhost:1081/mockserver/dashboard
MockServer can present a valid X.509 Certificates for any hostname.
services:
mockserver:
image: mockserver/mockserver:5.15.0
restart: on-failure:3
ports:
- 1081:1080