Comments (2)
Hi @neugartf, thanks for raising this.
You can have a percentage of responses fail, or use a particular status code by using a script step.
Here's a simple example:
---
plugin: openapi
specFile: petstore.yaml
resources:
- path: /pets
steps:
- type: script
code: |
if (Math.random() < 0.5) {
respond().withStatusCode(500);
} else {
respond().withStatusCode(200);
}
Here's a full example: https://github.com/outofcoffee/imposter/tree/main/examples/openapi/response-error-percentage
from imposter.
Terrific! Thank you 🙇.
from imposter.
Related Issues (20)
- Automatic template detection
- Arrays in Stores Transformed Upon Retrieval HOT 2
- xPath not valid for capture? HOT 6
- Unable to get REST plug in HOT 2
- when processing a request with charset=UTF-8, a groovy script gets special Unicode characters as question marks out of context.request.body HOT 1
- Mock Dummy PDF from OpenAPI HOT 1
- Expected getting implicit sample responses based on response-schema, get nothing instead HOT 7
- docs: describe health check / readiness probes
- Mock Calls for All Values of a Path Parameter HOT 4
- SOAP - auto generate fault responses
- queryParams No Longer Working HOT 5
- Access to OpenAPI 'operation' object in es2022 scripting.
- Support multiple OpenAPI specifications HOT 3
- Cannot Retrieve from Store on 4.0.3 HOT 1
- Setting IMPOSTER_PLUGIN_DIR in AWS Begets '<directory> is not a valid directory' HOT 2
- Support for Different Sequential Responses to the Same Request HOT 2
- Local Imposter Doesn't Error but when deployed on AWS lambda it complains about issues.
- Cache Invalidation Upon Store Update?
- Proxy: allow option to record request body as part of output config
- Getting 500 with 'Response already ended or closed'
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 imposter.