Andrew Allaire
Andrew Allaire

Reputation: 1340

Can wiremock json stubs be set to run my own script when end points are hit?

I am using wiremock json stubs, and have been reading the doc at http://wiremock.org/docs/stubbing/ But I can't seem to locate a complete list of all the options one can put in the response part of json stub file.

I can see how to give a response, and even how to cycle through scenarios and the like. But can't seem to find a way to do something else when I hit a particular end point. Is there a way to specify one's own script to be run when a particular end point is hit? Preferably with the endpoint as an argument supplied to the script?

In my case, and I anticipate in others there is a good reason to have side effects when end points are hit.

Upvotes: 0

Views: 648

Answers (1)

A. Kootstra
A. Kootstra

Reputation: 6971

Out of the box there isn't a way to call an external script. WireMock intended use is to provide a response to a request. There is a decent API and if your confident in java then it's not difficult to create custom Body transformer with the required logic.

Upvotes: 1

Related Questions