A node client for interfacing with WireMock's admin API
npm install wiremock-client



A node client for interfacing with WireMock's admin API
WARNING: THIS LIBRARY CURRENTLY EXPERIMENTAL AND IN A PRE-ALPHA STATE
javascript
const {Builders, Matchers, connect} = require('wiremock-client')const mock = connect('localhost', 8080)
mock.register(Builders.post(Matchers.urlPathMatching('/api/example'))
.withRequestBody(Matchers.containsPattern('token=auth'))
.willReturn(Builders.aResponse()
.withStatus(200)
.withHeader('Content-Type', Matchers.equalTo('application/json'))
.withBody({test: true})
)
)
`$3
`html
``javascript
const Builders = WireMock.Builders
const Matchers = WireMock.Matchersconst mock = WireMock.connect('localhost', 8080)
mock.register(Builders.post(Matchers.urlPathMatching('/api/example'))
.withRequestBody(Matchers.containsPattern('token=auth'))
.willReturn(Builders.aResponse()
.withStatus(200)
.withHeader('Content-Type', Matchers.equalTo('application/json'))
.withBody({test: true})
)
)
`Features
$3
#### Url Matchers
These matchers are used for matching request urls
##### Url Matching
`
urlMatching (url)
`
---urlPattern (pattern)
---
urlPathMatching (path)
---
`
urlPathPattern (pattern)
`
---#### Global Matchers
containsPattern(pattern)
equalTo(value)
$3
Stub mappings
Get all stub mapping
`
wireMock.getStubMapping(uuid)
`
---
Create new stub mapping
`
wireMock.register(mappingBuilder|mapping)
`
---
Delete all mapping
`
wireMock.removeMappings()
`
---
Delete all mapping
`
wireMock.removeMappings()
``---
Get a single stub mapping
---
Delete a stub mapping
---
Save all persistent stub mappings to the backing store
---
Find stubs by matching on their metadata
---
Remove stubs by matching on their metadata
---