pact-foundation / pact-mock_service

Provides a mock service for use with Pact
https://pact.io
MIT License
73 stars 69 forks source link

Raise/assume status code to be 200 if status code is not specified? #22

Open ivan-kolmychek opened 9 years ago

ivan-kolmychek commented 9 years ago

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:

bethesque commented 9 years ago

I think an error would be best, assumptions can be dangerous.

ivan-kolmychek commented 9 years ago

@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.