Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, **kw):
self._status = 200
self._mock = None
self._body = None
self._headers = HTTPHeaderDict()
# Trigger response method based on input arguments
trigger_methods(self, kw)
def __init__(self, method='GET', **kw):
self._url = None
self._body = None
self._query = None
self._method = method
self._extra = kw.get('extra')
self._headers = HTTPHeaderDict()
trigger_methods(self, kw)
# Stores the input request instance
self._request = request or Request()
# Stores the response mock instance
self._response = response or Response()
# Stores the mock matcher engine used for outgoing traffic matching
self.matchers = MatcherEngine()
# Stores filters used to filter outgoing HTTP requests.
self.filters = []
# Stores HTTP request mappers used by the mock.
self.mappers = []
# Stores callback functions that will be triggered if the mock
# matches outgoing traffic.
self.callbacks = []
# Triggers instance methods based on argument names
trigger_methods(self, kw)
# Trigger matchers based on predefined request object, if needed
if request:
_trigger_request(self, request)
# Stores the input request instance
self._request = request
# Stores the response mock instance
self._response = response or Response()
# Stores the mock matcher engine used for outgoing traffic matching
self.matchers = MatcherEngine()
# Stores filters used to filter outgoing HTTP requests.
self.filters = []
# Stores HTTP request mappers used by the mock.
self.mappers = []
# Stores callback functions that will be triggered if the mock
# matches outgoing traffic.
self.callbacks = []
# Triggers instance methods based on argument names
trigger_methods(self, kw)
# Trigger request fields, if present
if request:
_trigger_request(self, request)