mountebank
mountebank copied to clipboard
:zap: Expose `request` data directly into imposters
I've been testing Mountebank
and I stumble with some things I've already seen implemented in other software of the same nature. For instance, let's take a look at this imposter:
{
"name": "characters-api.create",
"port": 8090,
"protocol": "http",
"stubs": [
{
"predicates": [
{
"equals": {
"headers": {
"Accept": "application/json",
"Content-Type": "application/json"
},
"method": "POST",
"path": "/api/characters"
}
}
],
"responses": [
{
"is": {
"headers": {
"Location": "<% ${request.uri.path}/${uuid.generate} %>"
},
"statusCode": 201
}
}
]
}
]
}
At that point, all I'm interested is in grabbing the URI that was used (from the request
), generate some data on the fly (a UUID) and send the response back.
Is it possible to accomplish that in the way I'm describing it, or is it required to use behaviors.decorate
/ inject
?