-
Notifications
You must be signed in to change notification settings - Fork 0
yaml mapping
Bernard Niset edited this page Sep 11, 2022
·
1 revision
Mimus Serve allows to configure mapping as YAML files instead of JSON. This offers a more flexible and less verbose way of writing mappings. The JSON format origninating from WireMock is still supported.
In the yaml format and similar to the JSON format it is possible to put a single mapping in a file
request:
urlPathPattern: /proxy/.*
method: GET
response:
status: 200
proxyBaseUrl: https://swapi.dev
proxyUrlPrefixToRemove: /proxy
Also similar to JSON, multiple mappings can be put in an array property named mappings
.
mappings:
- request:
urlPath: /yaml/read-a-file
method: GET
response:
status: 200
bodyFileName: response.json
- request:
urlPath: /yaml/get-body
method: GET
response:
status: 200
body: Text content in a body - yaml
- request:
url: /yaml/get-from-url?param=value
method: GET
response:
status: 200
body: Get from url - yaml
Alternatively, muliple mappings can be defined in a multi document YAML file like the following.
---
request:
urlPattern: /yaml/get-from-url-patt.*
method: GET
response:
status: 200
body: Get from url pattern - yaml
---
request:
urlPathPattern: /yaml/get-from-url-path-patt.*
method: GET
response:
status: 200
body: Get from url path pattern - yaml
---
request:
url: /yaml/get-body
method: PUT
response:
status: 200
body: Should not be triggered by a get - yaml