Mercurial > p > roundup > code
comparison test/test_liveserver.py @ 7159:765222ef4cec
- issue2551257: add 'X-Content-Type-Options: nosniff' header for file download
when downloading an attached (user supplied file), make sure that an
'X-Content-Type-Options: nosniff' header is sent.
Added test for header as well.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 23 Feb 2023 16:20:32 -0500 |
| parents | a9be849d4dd2 |
| children | 273c8c2b5042 |
comparison
equal
deleted
inserted
replaced
| 7158:89f84f0d7cd3 | 7159:765222ef4cec |
|---|---|
| 1195 self.assertIn("test1.txt", f.text) | 1195 self.assertIn("test1.txt", f.text) |
| 1196 | 1196 |
| 1197 # download file and verify content | 1197 # download file and verify content |
| 1198 f = session.get(self.url_base()+'/file%(file)s/text1.txt'%m.groupdict()) | 1198 f = session.get(self.url_base()+'/file%(file)s/text1.txt'%m.groupdict()) |
| 1199 self.assertEqual(f.text, file_content) | 1199 self.assertEqual(f.text, file_content) |
| 1200 self.assertEqual(f.headers["X-Content-Type-Options"], "nosniff") | |
| 1200 print(f.text) | 1201 print(f.text) |
| 1201 | 1202 |
| 1202 def test_new_file_via_rest(self): | 1203 def test_new_file_via_rest(self): |
| 1203 | 1204 |
| 1204 session = requests.Session() | 1205 session = requests.Session() |
