Comments (1)
@xeroxis-xs it looks like you're using (and our docs show) outdated configuration options for the Prism Client.
mock
config option no longer controls whether the client is in mock or proxy mode. isProxy
controls this.
So if you update your prism.js
code to be the following, the prism client behaves as you expect:
const { getHttpOperationsFromSpec } = require('@stoplight/prism-cli/dist/operations');
const { createClientFromOperations } = require('@stoplight/prism-http/dist/client');
const { URL } = require('url');
async function main() {
const operations = await getHttpOperationsFromSpec('cat_facts.yaml');
const client = createClientFromOperations(operations, {
mock: { dynamic: false },
validateRequest: true,
validateResponse: true,
checkSecurity: false,
errors: true,
upstream: new URL("https://cat-fact.herokuapp.com/"),
upstreamProxy: undefined,
isProxy: true,
});
client.request('https://cat-fact.herokuapp.com/facts', { method: 'get' }).then(console.log);
}
main().catch((error) => {
console.error(error);
});
I've put up a PR to update our documentation to reflect the correct configuration operations as well.
from prism.
Related Issues (20)
- Gherkin Scenario for Prism HOT 3
- `prism --dynamic` returns 500's with `TypeError: Cannot read properties of null (reading 'value')` HOT 4
- Feature: support Optional security and AND security scheme groups HOT 1
- Urls generated with Ids could be static
- arrays never have less than maxItems in dynamic responses HOT 5
- Bug: JSON body parsing with "qouted" JSON-keys HOT 1
- Wrong validation of request body with integer type property HOT 2
- "title": "Tried to force a dynamic response for: application/json but schema is not defined.", HOT 1
- Update http-spec dependency HOT 2
- Multiple cookies in Set-Cookie header at one response HOT 8
- Serving Multiple OpenAPI Documents - Without any/differing prefixes? HOT 1
- Spike: Slow dns lookups from api-design to hasura
- An invalid schema will cause the validation proxy to always pass HOT 1
- query parameter name with "[]" not work on prism proxy
- Same URLs with differently typed path variables does not route correctly HOT 2
- Prism misvalidate boolean query params HOT 1
- [NOT A BUG -> QUESTION] how to set fix path variables HOT 2
- Add dynamic mocking to proxy
- Unable to build binary on node.js 20 HOT 2
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 prism.