Hi all, i am trying to use wiremock for mocking re...
# general
v
Hi all, i am trying to use wiremock for mocking responses and callback .
Copy code
{
    "request": {
        "method": "POST",
        "urlPattern": {{url_match_pattern}}
    },
    "response": {
        "status": 200,
        "jsonBody": {
            "request_id": {{request_id_one}}
        },
        "headers": {
            "Content-Type": "application/json"
        }
    },
    "serveEventListeners": [
        {
            "name": "l3vpn",
            "parameters": {
                "method": "POST",
                "url": "{{jsonPath originalRequest.query '$.callback_url'}}/{{request_id_one_str}}",
                "delay": {
                    "type": "fixed",
                    "milliseconds": 5000
                },
                "headers": {
                    "Content-Type": "application/json"
                },
                "jsonBody": {
                    "inprocess": "in process method"
                }
            }
        }
     ]
 }
The callback is received on the callback_url passed along in the headers of request. But the content of callback is empty. i expect following response in the callback body:
Copy code
"inprocess": "in process method"
t
If the callback URL is a normal query parameter then JSONPath extraction won’t work. Try something like:
Copy code
url": "{{originalRequest.query.callback_url.0'}}"
v
thanks. I think my question is not clear enough. My problem is that the body recevied on the callback_url is empty.
t
Not sure I understand what you mean - can you elaborate?
v
i receive POST on the callback_url. but the received body on the callback_url is empty.
t
What do you mean “body on the callback_url”?
The HTTP request body sent to your target endpoint?
Ah, I see the problem -
jsonBody
isn’t supported for webhooks
Use
body
instead, which needs to be a String
v
ok.. thanks. does it mean that i cannot use jsonbody in webhooks?
t
Yes, that's correct
v
ok. Thanks
I have another quey. but it is a bit of explanation required for it. here it is: i want to return a random request id in response and use the same request id in callback body. Is it possible ?
i am putting this on the main chat window .. thanks