1.0.36 • Published 5 years ago

wiremock-client v1.0.36

Weekly downloads
47
License
MIT
Repository
-
Last release
5 years ago

WireMock Client

npm version Build Status Coverage Status Maintainability

A node client for interfacing with WireMock's admin API

WARNING: THIS LIBRARY CURRENTLY EXPERIMENTAL AND IN A PRE-ALPHA STATE

Node Example

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})
  )
)

Browser Example

<script src="wiremock-client.js"></script>
const Builders =  WireMock.Builders
const Matchers =  WireMock.Matchers

const 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

Matchers

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)

Mappings

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()

Reset stub mappings


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


Requests

Recordings

scenarios

Near Misses

Settings

Shutdown

1.0.36

5 years ago

1.0.35

6 years ago

1.0.33

6 years ago

1.0.31

6 years ago

1.0.30

6 years ago

1.0.29

6 years ago

1.0.28

6 years ago

1.0.26

6 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.10

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.0

6 years ago