1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 08:04:49 +01:00

recorer: actually fix content-type on warcinfo, add to test!

This commit is contained in:
Ilya Kreymer 2016-04-30 13:07:53 -07:00
parent 0fbae1c7f8
commit 228ca58c5b
2 changed files with 2 additions and 2 deletions

View File

@ -418,6 +418,7 @@ class TestRecorder(LiveServerTests, FakeRedisTests, TempDirTests, BaseTestClass)
parsed_record = ArcWarcRecordLoader().parse_record_stream(buff)
assert parsed_record.rec_headers.get_header('WARC-Type') == 'warcinfo'
assert parsed_record.rec_headers.get_header('Content-Type') == 'application/warc-fields'
assert parsed_record.rec_headers.get_header('WARC-Filename') == 'testfile.warc.gz'
buff = parsed_record.stream.read().decode('utf-8')

View File

@ -120,7 +120,6 @@ class BaseWARCWriter(object):
if filename:
headers['WARC-Filename'] = filename
headers['WARC-Date'] = datetime_to_iso_date(datetime.datetime.utcnow())
headers['Content-Type'] = 'application/warc-fields'
warcinfo = BytesIO()
for n, v in six.iteritems(kwargs):
@ -174,7 +173,7 @@ class BaseWARCWriter(object):
if not content_type:
content_type = self.WARC_RECORDS[record.rec_headers['WARC-Type']]
self._header(out, 'Content-Type', record.content_type)
self._header(out, 'Content-Type', content_type)
if record.rec_headers['WARC-Type'] == 'revisit':
http_headers_only = True