Mountebank: Ability to add names for stubs

263 views Asked by At

Is there a way to tag stubs of an imposter with some identifiers so that while debugging, we can easily get the matches for a specific stub?

Currently the stub has a matches field, but when we want to verify programmatically if a certain stub has really been called, there is no way to get the matches for a specific stub we are interested in.

If there was a way to tag a stub, then we can filter the stub based on the tag and get the matches for that specific stub.

1

There are 1 answers

1
bbyars On

You can add whatever information you want to the stub and see it reflected when you request the imposter details. For example:

{
  "protocol": "http",
  "port": 3000,
  "stubs": [{
    "name": "example",
    "responses": [...]
  }]
}

Then you'll see that "name" field when you send a GET request to http://localhost:2525/imposters/3000.

-Brandon