Joel P.FR.
04/06/2024, 10:35 AM<https://jsonplaceholdfollowsicode.com/todos/1>
.Joel P.FR.
04/06/2024, 10:35 AMstart
as folows:
POST <http://localhost:8080/__admin/recordings/start>
Content-Type: application/json
{
"targetBaseUrl" : "<https://jsonplaceholder.typicode.com>",
"captureHeaders" : {
"Accept" : { },
"Content-Type" : {
"caseInsensitive" : true
}
},
"requestBodyPattern" : {
"matcher" : "equalToJson",
"ignoreArrayOrder" : false,
"ignoreExtraElements" : true
},
"persist" : false,
"repeatsAsScenarios" : false,
"transformers" : [ "modify-response-header" ],
"transformerParameters" : {
"headerValue" : "123"
}
}
• Then, I try to get the todo
detail with:
GET <http://localhost:8080/todos/1> (proxy with the targetUrl)
• Finally, launch the stop
: `
POST <http://localhost:8080/__admin/recordings/stop>
Joel P.FR.
04/06/2024, 10:36 AM{
"mappings": [
{
"id": "5775bb25-7063-4990-b198-6e08d2473408",
"name": "todos_1",
"request": {
"url": "/todos/1",
"method": "GET",
"headers": {
"Accept": {
"equalTo": "*/*"
}
}
},
"response": {
"status": 200,
"body": "�� ���%�WV\rm%\n:�˫�y�ȁ[�P߁��>��w9s\b�èS7���˻�늇>qs*��\f�",
"headers": {
"CF-RAY": "870117011b83867e-MAD",
"Server": "cloudflare",
"X-Ratelimit-Remaining": "999",
"X-Content-Type-Options": "nosniff",
"Pragma": "no-cache",
"Reporting-Endpoints": "heroku-nel=<https://nel.heroku.com/reports?ts=1711146555&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&s=%2ByQQY5%2FiCGMIRgu2T4yZyl6O7Od6LelxVF5Ou5BCbO0%3D>",
"Date": "Sat, 06 Apr 2024 10:28:13 GMT",
"Via": "1.1 vegur",
"X-Ratelimit-Reset": "1711146598",
"X-Ratelimit-Limit": "1000",
"CF-Cache-Status": "HIT",
"Etag": "W/\"53-hfEnumeNh6YirfjyjaujcOPPT+s\"",
"Cache-Control": "max-age=43200",
"Nel": "{\"report_to\":\"heroku-nel\",\"max_age\":3600,\"success_fraction\":0.005,\"failure_fraction\":0.05,\"response_headers\":[\"Via\"]}",
"Access-Control-Allow-Credentials": "true",
"Report-To": "{\"group\":\"heroku-nel\",\"max_age\":3600,\"endpoints\":[{\"url\":\"<https://nel.heroku.com/reports?ts=1711146555&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&s=%2ByQQY5%2FiCGMIRgu2T4yZyl6O7Od6LelxVF5Ou5BCbO0%3D>\"}]}",
"Vary": "Origin, Accept-Encoding",
"Expires": "-1",
"alt-svc": "h3=\":443\"; ma=86400",
"Age": "18342",
"X-Powered-By": "Express",
"Content-Type": [
"application/json; charset=utf-8",
"application/json"
]
}
},
"uuid": "5775bb25-7063-4990-b198-6e08d2473408"
}
]
}
Joel P.FR.
04/06/2024, 10:38 AMbody
value is
"body": "�� ���%�WV\rm%\n:�˫�y�ȁ[�P߁��>��w9s\b�èS7���˻�늇>qs*��\f�",
Is it possible to get the body with json format u through the jsonBody
value?Lee Turner
04/07/2024, 8:54 AM/todos/1
endpoint directly I get a content-encoding: br
header back. This means the response is encoded using the Brotli algorithm. I guess WireMock doesn't understand this response encoding which is why you are seeing the garbage in the body element.
If I make the request to the endpoint with the Accept-Encoding: identity
header then I no longer see the content-encoding: br
header coming back. identity
means no compression.
Try recording a request with the Accept-Encoding: identity
header and see if that helps.Joel P.FR.
04/09/2024, 7:03 PMLee Turner
04/09/2024, 8:53 PM