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

Can't mock error response after an example is chosen #1073

Closed
lehphyro opened this issue Apr 1, 2020 · 4 comments · Fixed by #1074
Closed

Can't mock error response after an example is chosen #1073

lehphyro opened this issue Apr 1, 2020 · 4 comments · Fixed by #1074
Labels

Comments

@lehphyro
Copy link
Contributor

lehphyro commented Apr 1, 2020

Describe the bug
Prefer: code=400 doesn't work after a request with Prefer: example=elon is sent.
It works if no example has been chosen previously.

To Reproduce

  1. Given the attached OpenAPI document
  2. Run this CLI command: prism mock openapi.yaml -h 0.0.0.0
  3. Execute the following requests:

curl -H "Prefer: example=elon" http://localhost:14080/client-api/v2/test
curl -H "Prefer: code=400" http://localhost:14080/client-api/v2/test

Expected behavior
I expect a 400 error response in the second request, I get the same response as the first request instead.

Additional context
Might be related to #1071
openapi.txt

@XVincentX
Copy link
Contributor

Can you try this branch? #1074

@lehphyro
Copy link
Contributor Author

lehphyro commented Apr 2, 2020

That fixes the issue 👍

@lehphyro
Copy link
Contributor Author

lehphyro commented Apr 2, 2020

@XVincentX that's was quick :) Maybe you can help fix this issue in spectral that's been open for a while? stoplightio/spectral#870

@XVincentX
Copy link
Contributor

@lehphyro Tengo dos manos solo :)

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

Successfully merging a pull request may close this issue.

2 participants