def test_to_str_exclude():
def exclude(h):
if h[0].lower() == 'multi-line':
return None
return h
sah = StatusAndHeadersParser(['HTTP/1.0']).parse(StringIO(status_headers_1))
res = sah.to_str(exclude)
exp = "\
HTTP/1.0 200 OK\r\n\
Content-Type: ABC\r\n\
Some: Value\r\n\
"
assert(res == exp)
assert(sah.to_bytes(exclude) == (exp.encode('latin-1') + b'\r\n'))
评论列表
文章目录