def send(self, request, **kwargs): request = _RequestObjectProxy(request, **kwargs) self._add_to_history(request) for matcher in reversed(self._matchers): try: resp = matcher(request) except Exception: request._matcher = weakref.ref(matcher) raise if resp is not None: request._matcher = weakref.ref(matcher) resp.connection = self return resp raise exceptions.NoMockAddress(request)
def send(self, request, **kwargs): request = _RequestObjectProxy(request, case_sensitive=self._case_sensitive, **kwargs) self._add_to_history(request) for matcher in reversed(self._matchers): try: resp = matcher(request) except Exception: request._matcher = weakref.ref(matcher) raise if resp is not None: request._matcher = weakref.ref(matcher) resp.connection = self logger.debug('{} {} {}'.format(request._request.method,request._request.url, resp.status_code)) return resp raise exceptions.NoMockAddress(request)