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

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

Open
ivan-kolmychek opened this issue Jun 2, 2015 · 2 comments

Comments

@ivan-kolmychek
Copy link

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;
@ivan-kolmychek ivan-kolmychek changed the title Raise/assume status: 200 if status is not specified? Raise/assume status code to 200 if status code is not specified? Jun 2, 2015
@ivan-kolmychek ivan-kolmychek changed the title Raise/assume status code to 200 if status code is not specified? Raise/assume status code to be 200 if status code is not specified? Jun 2, 2015
@bethesque
Copy link
Member

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

@ivan-kolmychek
Copy link
Author

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

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

2 participants