Rainer Scholz
06/27/2024, 10:36 AMrequest
- "urlPathTemplate": "/organizations/{organization}/members/{member}"
inside a serveEventListeners
- "url": "<https://my.organization.net/webhook-processor/organizations/{{originalRequest.path.organization}}/members/{{originalRequest.path.member}}/activated>"
.
It seems that this is only possible inside a response
definition. Any advice e.g. available extensions to help me?Tom
06/27/2024, 12:58 PM{{originalRequest.path.3}}
Rainer Scholz
06/27/2024, 1:12 PM{{originalRequest.pathSegments.3}}
now and it works.
As a side quest: It would be really cool if the wiremock-jwt-extension would be able to encode the parameters inside the jwt as well, e.g. "Authorization": "Bearer {{{jwt maxAge='5 seconds' sub='{{originalRequest.pathSegments.3}}' }}}"
Lee Turner
06/28/2024, 7:46 PMRainer Scholz
07/01/2024, 7:12 AMLee Turner
07/01/2024, 7:41 AMLee Turner
07/01/2024, 8:39 AM3.8.0
but I think this should work in the previous release as well - 3.7.0
{
"request": {
"method": "POST",
"urlPathTemplate": "/transfer/{name}"
},
"response": {
"status": 200,
"jsonBody": {
"message": "transfer succeeded!"
},
"headers": {
"Content-Type": "application/json"
}
},
"serveEventListeners": [
{
"name": "webhook",
"parameters": {
"method": "POST",
"url": "<https://webhook.site/2865e463-1f98-4899-8837-90b89364a5dc/{{originalRequest.path.name}}>",
"headers": {
"Content-Type": "application/json",
"Accept": "application/json"
},
"body": "{\"oldState\": {}, \"newState\": {}}"
}
}
]
}
A webhook request was made to <https://webhook.site/2865e463-1f98-4899-8837-90b89364a5dc/lee>
when I posted a request to <http://localhost:8080/transfer/lee>
Rainer Scholz
07/01/2024, 8:39 AMRainer Scholz
07/05/2024, 11:29 AM{{originalRequest.path.name}}
is working like you described.
I'm also able to confirm that using templates inside wiremock-jwt-extension (e.g. "Authorization": "Bearer {{{jwt maxAge='5 seconds' sub='{{originalRequest.path.name}}' }}}"
) are not working, but that's probably another topic.Lee Turner
07/05/2024, 12:56 PMLee Turner
07/05/2024, 12:57 PMAuthorization": "Bearer {{{jwt maxAge='5 seconds' sub=(trim originalRequest.path.name) }}}
Rainer Scholz
07/05/2024, 3:57 PM