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:
parent
0fbae1c7f8
commit
228ca58c5b
@ -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')
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user