Cookies are treated unusually in requests. To handle them exactly as
requests does we would need to create httplib responses with headers and
pass those back. This would be a significant change that is a little
tricky. Instead use the available requests cookies handlers to merge the
cookies into the responses returned from the adapter.
Provide a way to create and preload a CookieJar that will be returned as
part of responses. We also provide the dict interface that requests
does. We don't really have a lot of choice here as these interfaces are
supported by the cookie apis and we would need to actively work around
things to remove that interface.
Change-Id: Ifc1253abc1b4004e81aa7bffad1faf32aedd0d4c
Closes-Bug: #1480835
We need a way for custom matchers to be able to return fully formed
responses. Make a new function for this and convert the existing
response matchers to use it.
This is the same as the Mocker() however it looks more correct to do
@requests_mock.mock() rather than @requests_mock.Mocker().
Ideally mock() would be the decorator and Mocker() the context manager
but it doesn't really matter.
This shouldn't be considered the way to use these methods, using the
strings are fine, but in certain places people don't like using strings
everywhere and so we should have the constants available for them.
I think it makes more sense to have the adapter be more prominent and
then provide on top a number of was of installing the adapter.
Still not sure on how to provide some concepts like returning a series.