patrys / httmock

A mocking library for requests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Treats False results as handling failure

abentley opened this issue · comments

Requests treats responses with status codes from 400 to 600 as False, but HTTMock's _fake_send treats False return values as lookup failures. This means that HTTMock cannot simulate an error result. It will fall back to the real Session.send, which will do a real network operation, which may produce an error result. (Suggestion: emit a DEBUG log when HTTMock falls back to a real network operation.)

Merged now. Please note that it was replaced with an explicit check for a Response object.