pact-mock_service
pact-mock_service copied to clipboard
Raise/assume status code to be 200 if status code is not specified?
I'm not sure where to post it - I encountered it when used pact + pact-mock_service, so, I've decided to post it here.
When you accidentaly forget to specify status
response option you can get strange result with Net::HTTP
:
Net::HTTPBadResponse:
wrong status line: "HTTP/1.1 0 "
I see such possible solutions:
- raise an exception if status is not specified - it would be nice because error message can explicitly say "you forgot the status code" instead of assuming it as
0
- or assume it to be
200
- it's the most common expected response code IMO;
I think an error would be best, assumptions can be dangerous.
@bethesque I agree - it's better to explicitly point to this error instead of assuming anything (0 or 200), but I just wanted to present other possible solution I've thought about anyway.