Hello everyone, I'm posting a request with header ...
# help
d
Hello everyone, I'm posting a request with header
Content-Type: multipart/form-data
to wiremock, as it's the only accepted content-type accepted by my real third-party. Using only basic JSON stub, is it possible to extract the body from the request and pass it to a webhook body ? When I post my request with content-type
application/json
, the following stub works very well and I receive the transcript_id from the original request. But as soon as I send the original request with
multipart/form-data
, it doesn't work anymore :
Copy code
{
  "request": ...,
  "response": ...,
  "serveEventListeners": [
    {
      "name": "webhook",
      "parameters": {
        ...
        "body": "{\"transcript_id\":\"{{jsonPath originalRequest.body '$.transcript_id'}}\"}"
      }
    }
  ]
}
t
When handling a multipart request, you’ll need to extract the part that contains the JSON you want to use, so something like:
Copy code
{{jsonPath originalRequest.parts.<part name>.body '$.transcript_id'}}