mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-24 09:18:27 +02:00
Correct DELETE with body documentation
@@ -249,13 +249,10 @@ Example : `11111110-a633-40e8-a244-5cb80bc0ab66.json`
|
|||||||
```
|
```
|
||||||
|
|
||||||
### `DELETE /__admin/mappings`
|
### `DELETE /__admin/mappings`
|
||||||
Delete all stub mappings.
|
Delete all stub mappings. (If there is no request body).
|
||||||
|
|
||||||
### `DELETE /__admin/mappings`
|
### `DELETE /__admin/mappings`
|
||||||
Delete all stub mappings matched to the GUIDs in the body of request.
|
Delete the stub mappings matched to the GUIDs in the request body.
|
||||||
NOTE: `AllowBodyForAllHttpMethods` must be set to true in Admin Settings for this feature to work. Otherwise, body will arrive to the service empty and delete all stub mappings.
|
|
||||||
|
|
||||||
Delete an existing stub mapping (identical to the POST request, but deletes instead of create)
|
|
||||||
|
|
||||||
Example request:
|
Example request:
|
||||||
```js
|
```js
|
||||||
@@ -265,52 +262,27 @@ Example request:
|
|||||||
"Url": "/testabc",
|
"Url": "/testabc",
|
||||||
"Methods": [
|
"Methods": [
|
||||||
"put"
|
"put"
|
||||||
],
|
]
|
||||||
"Headers": [
|
|
||||||
{
|
|
||||||
"Name": "Content-Type",
|
|
||||||
"Matchers": [
|
|
||||||
{
|
|
||||||
"Name": "WildcardMatcher",
|
|
||||||
"Pattern": "application/*"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Cookies": [],
|
|
||||||
"Params": [
|
|
||||||
{
|
|
||||||
"Name": "start",
|
|
||||||
"Values": [ "1000", "1001" ]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Body": {
|
|
||||||
"Matcher": {
|
|
||||||
"Name": "JsonPathMatcher",
|
|
||||||
"Pattern": "$.things[?(@.name == 'RequiredThing')]"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"Response": {
|
"Response": {
|
||||||
"UseTransformer": true,
|
"Body": "Response Body",
|
||||||
"StatusCode": 205,
|
|
||||||
"BodyAsJson": { "result": "test - {{request.path}}" },
|
|
||||||
"Headers": {
|
"Headers": {
|
||||||
"Content-Type": "application/json", "a" : "b"
|
"Content-Type": "application/json"
|
||||||
},
|
}
|
||||||
"Delay": 10
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
The only truly necessary piece of the body json is the Guid.
|
||||||
This is also valid syntax for the request (demonstrates multi-delete):
|
So this is also valid syntax for the request (demonstrates multi-delete):
|
||||||
|
```js
|
||||||
[{
|
[{
|
||||||
"Guid": "dae02a0d-8a33-46ed-aab0-afbecc8643e3"
|
"Guid": "dae02a0d-8a33-46ed-aab0-afbecc8643e3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Guid": "c181c4f6-fe48-4712-8390-e1a4b358e278"
|
"Guid": "c181c4f6-fe48-4712-8390-e1a4b358e278"
|
||||||
}]
|
}]
|
||||||
|
```
|
||||||
|
The most obvious application of DELETE with request body will be the ability to send identical requests to the __admin/mappings endpoint using POST and DELETE interchangeably. Additionally, this provides a useful "multi-delete" feature.
|
||||||
|
|
||||||
### `GET /__admin/mappings/{guid}`
|
### `GET /__admin/mappings/{guid}`
|
||||||
Get a single stub mapping
|
Get a single stub mapping
|
||||||
|
|||||||
Reference in New Issue
Block a user