Ramon de Beijer
04/18/2024, 2:16 PMversion: "3"
services:
wiremock:
image: "wiremock/wiremock:latest"
container_name: mock-server
ports:
- "127.0.0.1:3002:8080"
- "127.0.0.1:3443:8443"
volumes:
- ./extensions:/var/wiremock/extensions
- ./__files:/home/wiremock/__files
- ./mappings:/home/wiremock/mappings
entrypoint: ["/docker-entrypoint.sh", "--global-response-templating", "--disable-gzip", "--verbose"]
extra_hosts:
- "host.docker.internal:host-gateway"
In one of my mappings I would like to use the `{{request.body}} (also tried request.host or request.headers.xxx), but it is always empty, am I missing something?
This should work right? It does make the call to that /v1/events/
endpoint but the body is { "message": "success", "originalRequestBody": "" }
{
"request": {
"headers": {
"x-amz-target": {
"matches": "AWSEvents.PutEvents"
}
}
},
"response": {
"proxyBaseUrl": "<http://host.docker.internal:4566>"
},
"serveEventListeners": [
{
"name": "webhook",
"parameters": {
"method": "POST",
"url": "<http://host.docker.internal:3000/v1/events/>",
"headers": {
"Content-Type": "application/json"
},
"body": "{ \"message\": \"success\", \"originalRequestBody\": \"{{request.body}}\" }",
"delay": {
"type": "fixed",
"milliseconds": 1000
}
}
}
]
}
Ramon de Beijer
04/18/2024, 3:04 PMLee Turner
04/19/2024, 8:36 AMoriginalRequest.body
in the end or are you still struggling ?Ramon de Beijer
04/19/2024, 8:38 AMLee Turner
04/19/2024, 8:42 AMRamon de Beijer
04/19/2024, 8:44 AM{
"key1": "value1",
"key2": "value2"
}
becomes
{\"key1\":\"value1\", \"key2\": \"value2\"}
Ramon de Beijer
04/19/2024, 8:44 AMLee Turner
04/19/2024, 8:45 AMRamon de Beijer
04/19/2024, 8:46 AMLee Turner
04/19/2024, 8:50 AMRamon de Beijer
04/19/2024, 8:50 AMLee Turner
04/19/2024, 8:51 AMreplace
helper - {{ replace value "..." "rocks" }}
Ramon de Beijer
04/19/2024, 8:52 AMRamon de Beijer
04/19/2024, 9:09 AMLee Turner
04/19/2024, 9:11 AMRamon de Beijer
04/19/2024, 9:13 AMRamon de Beijer
04/23/2024, 6:01 AMLee Turner
04/23/2024, 9:24 AM