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

Return more informative response codes #129

Open
bethesque opened this issue Jun 3, 2021 · 2 comments
Open

Return more informative response codes #129

bethesque opened this issue Jun 3, 2021 · 2 comments

Comments

@bethesque
Copy link
Member

If no interaction with the path matches -> 404
If an interaction with the path matches but the headers/request is wrong -> 400/405 or 415

@uglyog if you can point to a test that shows how the rust one does it, it would be good to make them the same.

@uglyog
Copy link
Member

uglyog commented Jun 3, 2021

The rust one is not correct either, because it returns a 500 on mismatch.

@uglyog
Copy link
Member

uglyog commented Jun 3, 2021

The logic should be:

  1. Find all interactions the having a matching path
  2. If there are none:
    1. If it is an OPTIONS request, respond as per a CORS pre-flight request
    2. Otherwise, return a 404
  3. Match the request, and return the following:
    1. If there is a mismatch on the method: 405
    2. If a POST/PUT/PATCH and there is a mismatch on the content type: 415 (can skip this one)
    3. Else if a mismatch: 400 (reason for the 500 here is 400 responses may be present in the Pact file)
    4. Else return response from Pact file

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