mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
head request replay fix: treat head requests as traditionally GET requests w/o payload, instead of HEAD request replay, see #309, mentioned in #307
This commit is contained in:
parent
98cdf36626
commit
e812ed2d45
@ -77,7 +77,7 @@ class DirectWSGIInputRequest(object):
|
||||
|
||||
method = self.get_req_method()
|
||||
|
||||
if method not in ('OPTIONS', 'HEAD', 'POST'):
|
||||
if method not in ('OPTIONS', 'POST'):
|
||||
return url
|
||||
|
||||
mime = self._get_content_type()
|
||||
|
@ -81,6 +81,20 @@ class TestWbIntegration(BaseConfigTest):
|
||||
|
||||
assert 'Content-Security-Policy' not in resp.headers
|
||||
|
||||
def test_replay_content_head(self, fmod):
|
||||
resp = self.head('/pywb/20140127171238{0}/http://www.iana.org/', fmod, status=200)
|
||||
assert not resp.headers.get('Content-Length')
|
||||
|
||||
def test_replay_content_head_non_zero_content_length_match(self):
|
||||
resp = self.testapp.get('/pywb/id_/http://www.iana.org/_js/2013.1/jquery.js', status=200)
|
||||
length = resp.content_length
|
||||
|
||||
# Content-Length included if non-zero
|
||||
resp = self.testapp.head('/pywb/id_/http://www.iana.org/_js/2013.1/jquery.js', status=200)
|
||||
|
||||
#assert resp.headers['Content-Length'] == length
|
||||
assert resp.content_length == length
|
||||
|
||||
def test_replay_content(self, fmod):
|
||||
resp = self.get('/pywb/20140127171238{0}/http://www.iana.org/', fmod)
|
||||
self._assert_basic_html(resp)
|
||||
|
Loading…
x
Reference in New Issue
Block a user