Comments (5)
Yes it is possible, if you use the clear function it will only remove the expectations that exactly match the request you provide, i.e:
mockServerClient.clear(
request()
.withPath("/test")
.withBody(xpath("//test=1"))
);
from mockserver.
Hi,
Thanks for the quick response! When I try that using JSON the expectations appears to remain.
My JSON for setting the expectation looks like this:
httpRequest": {
"method": "POST",
"path": "/test",
"body": {
"type": "XPATH",
"value": "//test=1"
},
"headers": [
{
"name": "SOAPAction",
"values": [""""]
}
]
},
"httpResponse": {
"statusCode": 200,
"headers": [
{
"name": "Content-Type",
"values": ["application/soap+xml; charset=utf-8"]
}
],
"body": "[SOME_SOAP_ENVELOPE]"
}
My JSON for removing the expectation looks like this:
{
"method": "POST",
"path": "/test",
"body": {
"type": "XPATH",
"value": "//test=1"
},
"headers": [
{
"name": "SOAPAction",
"values": [""""]
}
]
}
When I ommit the body part the expectation is removed.
Jeroen
from mockserver.
ok I'll take a look
from mockserver.
I've been away this weekend but I'll take a look in the next couple of days and add extra tests to make sure there aren't any bugs (or fix them if there are).
from mockserver.
I resolved the issue and added a test for this scenario
from mockserver.
Related Issues (20)
- Possible to have early response before consuming request body
- mockserver failed to initialize the server-side SSL context
- Multiple responses for the same request are not thread-safe
- mock-server client does not support TLS v1.3 HOT 2
- How to proxy to mockserver with auth HOT 1
- "SEVERE exception validating JSON" while parsing pathparameter of openapi-generated request matchers HOT 2
- No support for multi-line MUSTACHE templates in initializerJson.json
- A memory leak caused by the reset method not removing subscribers ultimately leads to an OutOfMemoryError HOT 2
- Extract current Expectations via API
- jsonschema allOf not managed
- CVE-2023-4911 vulnerability mockserver/mockserver:0.15.0
- Eliminate use of javax.servlet-api
- Support to add Image Pull Secrets for Docker Image
- Where is James ? HOT 1
- Repeated query parameters with the same value are missing from queryStringParameters
- Creating expectations from OpenAPI without components section
- docker MockServer on Raspberry PI 4 not working - java exec format error
- JSON String body. Double quotes in verification is ignored/JSON String body unwrapping in verification
- Need some extra pointers on maximizing single instance performance
- Experiencing high latency and CPU utilization when expectations size is large
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mockserver.