| 206 | assert request.headers["Host"] == request.authority == "example.org:22" |
| 207 | |
| 208 | def test_get_host_header(self): |
| 209 | no_hdr = treq() |
| 210 | assert no_hdr.host_header is None |
| 211 | |
| 212 | h1 = treq( |
| 213 | headers=((b"host", b"header.example.com"),), |
| 214 | authority=b"authority.example.com", |
| 215 | ) |
| 216 | assert h1.host_header == "header.example.com" |
| 217 | |
| 218 | h2 = h1.copy() |
| 219 | h2.http_version = "HTTP/2.0" |
| 220 | assert h2.host_header == "authority.example.com" |
| 221 | |
| 222 | h2_host_only = h2.copy() |
| 223 | h2_host_only.authority = "" |
| 224 | assert h2_host_only.host_header == "header.example.com" |
| 225 | |
| 226 | def test_modify_host_header(self): |
| 227 | h1 = treq() |