pact-mock_service
pact-mock_service copied to clipboard
Return more informative response codes
trafficstars
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.
The rust one is not correct either, because it returns a 500 on mismatch.
The logic should be:
- Find all interactions the having a matching path
- If there are none:
- If it is an OPTIONS request, respond as per a CORS pre-flight request
- Otherwise, return a 404
- Match the request, and return the following:
- If there is a mismatch on the method: 405
- If a POST/PUT/PATCH and there is a mismatch on the content type: 415 (can skip this one)
- Else if a mismatch: 400 (reason for the 500 here is 400 responses may be present in the Pact file)
- Else return response from Pact file