Mercurial > hg
changeset 18400:f1118507174b
get-with-headers: add a --headeronly switch
In some case we do not care about the actual rendering.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 16 Jan 2013 14:26:19 +0100 |
parents | 66cec3c2ee00 |
children | 683a76a07325 |
files | tests/get-with-headers.py |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/get-with-headers.py Tue Jan 15 22:08:47 2013 -0600 +++ b/tests/get-with-headers.py Wed Jan 16 14:26:19 2013 +0100 @@ -16,6 +16,10 @@ if '--twice' in sys.argv: sys.argv.remove('--twice') twice = True +headeronly = False +if '--headeronly' in sys.argv: + sys.argv.remove('--headeronly') + headeronly = True reasons = {'Not modified': 'Not Modified'} # python 2.4 @@ -37,13 +41,13 @@ for h in [h.lower() for h in show]: if response.getheader(h, None) is not None: print "%s: %s" % (h, response.getheader(h)) + if not headeronly: + print + data = response.read() + sys.stdout.write(data) - print - data = response.read() - sys.stdout.write(data) - - if twice and response.getheader('ETag', None): - tag = response.getheader('ETag') + if twice and response.getheader('ETag', None): + tag = response.getheader('ETag') return response.status