Comments (8)
@razb-viola could you please provide the following:
- example spec to reproduce the issue
- command used to start up Prism (i.e. prism mock ...)
- example request you're sending the mock server to reproduce the issue
- response gotten from your sample request
- expected response from your sample request
from prism.
@chohmann this is a typical headers response:
responses:
"201":
description: Signed in validated successfully
headers:
Set-Cookie:
schema:
type: string
example: Authorization=Bearer token; Path=/; HttpOnly
Now how can I set Refresh token cookie as well? in the same response. I can only send one cookie not multiple.
from prism.
@razb-viola we really need all of the information asked for in my previous comment before we can really look into this issue.
Could you please provide the following:
- FULL example spec to reproduce the issue
- command used to start up Prism (i.e. prism mock ...)
- example request you're sending the mock server to reproduce the issue
- response gotten from your sample request
- expected response from your sample request
from prism.
@chohmann you ask things that already mentioned here. Could you please just tell me how to set it work the right way instead?
from prism.
@razb-viola I'm sorry, but we are unable to proceed without the information requested from @chohmann above. We will be closing this issue out but feel free to open a new issue when you're able to provide that information.
from prism.
Hi guys I am trying to register 2 cookies in the same response header - what actually happens is that only one cookie is registered (the first one but never the second one).
Lets answer your questions one by one:
- FULL example spec to reproduce the issue
- command used to start up Prism (i.e. prism mock ...)
- example request you're sending the mock server to reproduce the issue
- response gotten from your sample request
- expected response from your sample request
Answers:
- What do you mean by full? my OAS spec is around 3k of lines. I have provided the exact part that is relevant. The part that I am sending the 200 status code response with the Set-Cookie header is just the only needed part, believe me. If it helps, I tried both on OpenApi version 3.0 and 3.1. Both didn't work.
- Just as you said, I use:
prism mock ./path/to/oas.yaml
- The Content-Type header is application/json, but it doesn't matter to mention this, since there is no problem with the request because the first cookie is registered.
- A traditional Set-Cookie response header BUT with the value of the first cookie only.
- A traditional Set-Cookie header with the value of BOTH cookies.
**
This is the updated spec, with two cookies but only the accessToken
will be saved in the browser's cookies:
responses:
"201":
description: Signed in validated successfully
headers:
Set-Cookie:
schema:
type: string
examples:
- accessToken=token; Path=/; HttpOnly // only this will be registered.
- refreshToken=token; Path=/; HttpOnly
You know what? leave my issue aside and try by yourself. If you able to send 2 cookies on the same response - just tell me how.
I like prism and I would lovely glad to contribute to this repository as well, but please, bare with me, I provided all you need.
from prism.
@razb-viola thank you for providing most of the details we asked for. Prism is designed to only return one example value (either the first or whichever you configure in your request using the prefer header). We think in order to achieve what you're looking for, you'd have to combine both cookie values in one example:
responses:
"201":
description: Signed in validated successfully
headers:
Set-Cookie:
schema:
type: string
examples:
- accessToken=token; Path=/; HttpOnly; refreshToken=token; Path=/; HttpOnly
from prism.
I have tried this and it doesn't work. Only the first cookie will be saved.
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
- Prism Client not validating request and response from Server despite setting mock: false. HOT 1
- Update http-spec dependency HOT 2
- 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.