HTTP Setup
Send an HTTP request to one of your services before the test runs. This is useful for calling a seed endpoint, creating test data via API, or triggering any HTTP-accessible preparation logic.
setup:
- http:
target: http://api:8080
request:
method: POST
url: /api/seed
headers:
Content-Type: application/json
body: '{"fixtures": "users"}'
Fields
| Field | Required | Description |
|---|---|---|
target | yes | Base URL of the service (use the service name as hostname) |
request.method | yes | HTTP method |
request.url | yes | URL path |
request.headers | no | Request headers |
request.body | no | Request body |
The target uses the service name as hostname. If your service is named
api, the target is http://api:8080. This works because each test runs in its own Docker network where the service name becomes a DNS entry.Multiple HTTP steps
You can chain as many setup steps as you need. They run in order, top to bottom.
setup:
- http:
target: http://api:8080
request:
method: POST
url: /api/seed
body: '{"fixtures": "users"}'
- http:
target: http://api:8080
request:
method: POST
url: /api/seed
body: '{"fixtures": "products"}'