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

Add warning when no expectations are made of the response body for a post/put/patch #46

Open
bethesque opened this issue Sep 21, 2014 · 2 comments

Comments

@bethesque
Copy link
Member

Each interaction is tested in isolation, meaning you can't do a PUT/POST/PATCH, and then follow it with a GET to ensure that the values you sent were actually read successfully by the provider. If you send a lastname instead of a surname field, a provider will most likely ignore the misnamed field, and return a 200, failing to alert you to the fact that your lastname has gone to the big /dev/null in the sky.

The code should warn you when a POST/PUT/PATCH request is defined, with a non-empty body, that does not make any expectations about the response.

@sonjapeterson
Copy link

Hi! This makes sense to me, I could probably put together a PR--were you thinking this warning would appear when the interaction is defined in the consumer specs (so probably in pact-mock_service, I guess?), or when it's verified?

@bethesque
Copy link
Member Author

Hi Sonja. That would be great.

The warning would be best when the interaction is defined. We want the person writing the consumer tests to be aware of it before it gets written to the pact. Not sure whether it would be best in the consumer code in the main pact lib (because it's "closer" to the UI/console) or in the mock service (better for reuse). Not sure if the output from the mock service shows up in the console during tests or not - maybe you could look into this and come up with a proposal?

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

No branches or pull requests

3 participants