HTTP: the Date response header.

This commit is contained in:
Valentin Bartenev
2018-02-12 16:58:40 +03:00
parent dc50773e51
commit 9646772a00
4 changed files with 59 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
import time
import unittest
import unit
@@ -62,6 +63,9 @@ def application(environ, start_response):
headers = resp['headers']
self.assertRegex(headers.pop('Server'), r'unit/[\d\.]+',
'server header')
self.assertLess(abs(time.mktime(time.gmtime()) -
time.mktime(time.strptime(headers.pop('Date'),
'%a, %d %b %Y %H:%M:%S GMT'))), 5, 'date header')
self.assertDictEqual(headers, {
'Content-Length': str(len(body)),
'Content-Type': 'text/html',