def __init__( self, http_version, status_code, reason, headers, content, timestamp_start=None, timestamp_end=None, is_replay=False ): Response.__init__( self, http_version, status_code, reason, headers, content, timestamp_start=timestamp_start, timestamp_end=timestamp_end, ) # Is this request replayed? self.is_replay = is_replay self.stream = False
def __init__( self, http_version, status_code, reason, headers, content, timestamp_start=None, timestamp_end=None, is_replay = False ): Response.__init__( self, http_version, status_code, reason, headers, content, timestamp_start=timestamp_start, timestamp_end=timestamp_end, ) # Is this request replayed? self.is_replay = is_replay self.stream = False
def __init__( self, httpversion, status_code, msg, headers, body, timestamp_start=None, timestamp_end=None, ): Response.__init__( self, httpversion, status_code, msg, headers, body, timestamp_start=timestamp_start, timestamp_end=timestamp_end, ) # Is this request replayed? self.is_replay = False self.stream = False
def test_make(self): r = Response.make() assert r.status_code == 200 assert r.content == b"" r = Response.make(418, "teatime") assert r.status_code == 418 assert r.content == b"teatime" assert r.headers["content-length"] == "7" Response.make(content=b"foo") Response.make(content="foo") with raises(TypeError): Response.make(content=42) r = Response.make(headers=[(b"foo", b"bar")]) assert r.headers["foo"] == "bar" r = Response.make(headers=({"foo": "baz"})) assert r.headers["foo"] == "baz" with raises(TypeError): Response.make(headers=42)