mirror of
https://github.com/httpie/cli.git
synced 2024-11-08 08:55:05 +01:00
Ignore --download
with --offline
This commit is contained in:
parent
770976a66e
commit
4351650691
@ -78,7 +78,7 @@ class HTTPieArgumentParser(argparse.ArgumentParser):
|
||||
|
||||
# Arguments processing and environment setup.
|
||||
self._apply_no_options(no_options)
|
||||
self._validate_download_options()
|
||||
self._process_download_options()
|
||||
self._setup_standard_streams()
|
||||
self._process_output_options()
|
||||
self._process_pretty_options()
|
||||
@ -379,7 +379,11 @@ class HTTPieArgumentParser(argparse.ArgumentParser):
|
||||
# noinspection PyTypeChecker
|
||||
self.args.prettify = PRETTY_MAP[self.args.prettify]
|
||||
|
||||
def _validate_download_options(self):
|
||||
def _process_download_options(self):
|
||||
if self.args.offline:
|
||||
self.args.download = False
|
||||
self.args.download_resume = False
|
||||
return
|
||||
if not self.args.download:
|
||||
if self.args.download_resume:
|
||||
self.error('--continue only works with --download')
|
||||
|
@ -187,9 +187,8 @@ def test_offline():
|
||||
r = http(
|
||||
'--offline',
|
||||
'https://this-should.never-resolve/foo',
|
||||
'param==value'
|
||||
)
|
||||
assert 'GET /foo?param=value' in r
|
||||
assert 'GET /foo' in r
|
||||
|
||||
|
||||
def test_offline_download():
|
||||
@ -198,6 +197,5 @@ def test_offline_download():
|
||||
'--offline',
|
||||
'--download',
|
||||
'https://this-should.never-resolve/foo',
|
||||
'param==value'
|
||||
)
|
||||
assert 'GET /foo?param=value' in r
|
||||
assert 'GET /foo' in r
|
||||
|
Loading…
Reference in New Issue
Block a user