Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response selection using request cookie #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kryvel
Copy link

@kryvel kryvel commented Dec 3, 2021

In addition to the existing Prefer header functionality, I added the same but with a cookie.
Prefer header has greater priority over cookie

@jormaechea
Copy link
Owner

@kryvel thanks for the PR. Can you explain more your intention?
What is the expected behaviour?

The Prefer header is parsed using parse-prefer-header, this won't work if you just pass all the cookie header.

@jormaechea jormaechea added the needs information Issue needs more information label Dec 21, 2021
@kryvel
Copy link
Author

kryvel commented Mar 10, 2022

In some cases (eg. automated headless testing in browser via selenium) there is no possibility to send additional headers from client script. But possible to set cookie in browser with additional data, name of example or status code in this case. Such cookie will be sent by the client script to the mocker server.

parse-prefer-header parse only content of Prefer header. So, if Cookie header will contain the same data as Prefer header, it will work just fine.

@kryvel thanks for the PR. Can you explain more your intention? What is the expected behaviour?

The Prefer header is parsed using parse-prefer-header, this won't work if you just pass all the cookie header.

@jormaechea
Copy link
Owner

Understood. I think that there must be a predefined cookie with the same content of the prefer content, because parsing the whole cookie header will prevent other cookies to be sent (and will probably go against any standard out there).

For example, an OpenApiMockerPrefer cookie or something like that.
And it's content could be statusCode=400.

What do you think?

PS. Sorry about the delay, I couldn't pay any attention to spare-time projects..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs information Issue needs more information
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants