| 102 | |
| 103 | |
| 104 | async def test_HTTPFound(buf, http_request) -> None: |
| 105 | resp = web.HTTPFound(location="/redirect") |
| 106 | assert "/redirect" == resp.location |
| 107 | assert "/redirect" == resp.headers["location"] |
| 108 | await resp.prepare(http_request) |
| 109 | await resp.write_eof() |
| 110 | txt = buf.decode("utf8") |
| 111 | assert re.match( |
| 112 | "HTTP/1.1 302 Found\r\n" |
| 113 | "Content-Type: text/plain; charset=utf-8\r\n" |
| 114 | "Location: /redirect\r\n" |
| 115 | "Content-Length: 10\r\n" |
| 116 | "Date: .+\r\n" |
| 117 | "Server: .+\r\n\r\n" |
| 118 | "302: Found", |
| 119 | txt, |
| 120 | ) |
| 121 | |
| 122 | |
| 123 | def test_HTTPFound_empty_location() -> None: |