-
Notifications
You must be signed in to change notification settings - Fork 263
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
Cannot mock API by X-Mock header using Prism Windows #257
Comments
Thanks for reporting this @chrisprijic, I've added this to our backlog for review. In the mean time, perhaps the prism documentation or the StopLight team might have some insight. With Best Regards, Elmer |
Looks like the new version of prism uses As for this repo and my issue, I'll leave it up to you on how to handle this -- if prism's version needs to be explicitly stated or if you want to update to the newest prism way of mocking a particular response. If you want to update, I'd be happy to provide a PR for it. I'll check out the contributing docs tomorrow morning regardless. |
@thinkingserious did you guys update to the new version of Prism? If you did, let's make some time next week to migrate you over properly. Let me know. |
Hello @chrisprijic, We use this older version of Prism (here are the docs) in this manner. The functionality you want is available in the newest version of Prism. If you would like to help us with upgrading to the newest version, a PR would be most welcome :) Note that we have been moving towards setting up Prism within a Docker container, like so. With Best Regards, Elmer P.S. Thanks to @pytlesk4 for helping out! |
Here is an example of it with golang: https://github.com/pytlesk4/sendgrid-go/tree/prism-2.0 |
This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog. |
Issue Summary
I'm working on
struct-ing
out a bit more of the SendGrid API for a project, and am diving into testing the first few endpoints I've been building out (in hopes to provide some PR's in the future!)However, when running tests using prism and the provided SendGrid OAI spec (see below), I cannot mock anything else besides the "default" response code an endpoint provides. The X-Mock header doesn't seem to affect output from prism.
Steps to Reproduce
OS: Windows 10
Using: prism.exe (x64)
Version: 2.0.9
command:
prism.exe mock -d -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json
The above utilizes an
X-Mock
header to specify the response code to mock back. However, even when mocking endpoints likePOST /alerts
(below) without a request body, and withX-Mock
header set to400
, I still get a 201 response code and a 201 response body.Example code:
response status code:
201
response body:
I have tried altering the
oai-stoplight.json
beforeScript
functions but to no avail...Technical details:
The text was updated successfully, but these errors were encountered: