| 64 | self.request_class("/foo:bar") |
| 65 | |
| 66 | def test_headers(self): |
| 67 | # Different ways of setting headers attribute |
| 68 | url = "http://www.scrapy.org" |
| 69 | headers = {b"Accept": "gzip", b"Custom-Header": "nothing to tell you"} |
| 70 | r = self.request_class(url=url, headers=headers) |
| 71 | p = self.request_class(url=url, headers=r.headers) |
| 72 | |
| 73 | assert r.headers == p.headers |
| 74 | assert r.headers is not headers |
| 75 | assert p.headers is not r.headers |
| 76 | |
| 77 | # headers must not be unicode |
| 78 | h = Headers({"key1": "val1", "key2": "val2"}) |
| 79 | h["newkey"] = "newval" |
| 80 | for k, v in h.items(): |
| 81 | assert isinstance(k, bytes) |
| 82 | for s in v: |
| 83 | assert isinstance(s, bytes) |
| 84 | |
| 85 | def test_eq(self): |
| 86 | url = "http://www.scrapy.org" |