https://linen.dev logo
#help
Title
# help
k

Kaushal Gupta

04/28/2023, 6:24 AM
HI All, I am trying callback functionality with Wiremock standalone server It works fine when I pass the static values in the "url" field under postServeActions My scenario is that I have to capture the host and port of the incoming request and the same host and port are needed for the callback URL. my mapping body is below and the callback is not getting work as {{request.baseUrl}} value is not getting replaced in "url" field, please help me out here
Copy code
{
  "request": {
    "url": "/wiremock/middesk/v1/businesses",
    "method": "POST",
    "bodyPatterns": [
      {
        "matchesJsonPath": {
          "expression": "$..tin",
          "contains": "123"
        }
      }
    ]
  },
  "response": {
    "status": 200,
    "bodyFileName": "middesk-compliance-partner/customer_response/middeskInitiateResponse_success.json",
    "headers": {
      "Content-Type": "application/json; charset=utf-8"
    },
    "transformers": [
      "response-template",
      "body-transformer"
    ]
  },
  "postServeActions": [
    {
      "name": "webhook",
      "parameters": {
        "headers": {
          "Content-Type": "application/json"
        },
        "method": "POST",
        "url": "{{request.baseUrl}}/?code={{randomValue type='UUID'}}&state={{originalRequest.query.state}}",
        "delay": {
          "type": "fixed",
          "milliseconds": 10
        }
      }
    }
  ]
}
7 Views