You've already forked httpie-cli
mirror of
https://github.com/httpie/cli.git
synced 2025-08-10 22:42:05 +02:00
Replace --show-redirects with --all and add --print-others, -P
With --all, any intermediary requests/responses are shown (such as redirects or the initial unauthorized Digest auth request). The --print-others, -P option works like --print, -p, but only applies to intermediary requests/responses. The default behaviour is to inherit the value of -p.
This commit is contained in:
@@ -3,16 +3,38 @@ from httpie import ExitStatus
|
||||
from utils import http, HTTP_OK
|
||||
|
||||
|
||||
def test_follow_no_show_redirects(httpbin):
|
||||
def test_follow_all_redirects_shown(httpbin):
|
||||
r = http('--follow', '--all', httpbin.url + '/redirect/2')
|
||||
assert r.count('HTTP/1.1') == 3
|
||||
assert r.count('HTTP/1.1 302 FOUND', 2)
|
||||
assert HTTP_OK in r
|
||||
|
||||
|
||||
def test_follow_without_all_redirects_hidden(httpbin):
|
||||
r = http('--follow', httpbin.url + '/redirect/2')
|
||||
assert r.count('HTTP/1.1') == 1
|
||||
assert HTTP_OK in r
|
||||
|
||||
|
||||
def test_follow_show_redirects(httpbin):
|
||||
r = http('--follow', '--show-redirects', httpbin.url + '/redirect/2')
|
||||
assert r.count('HTTP/1.1') == 3
|
||||
assert r.count('HTTP/1.1 302 FOUND', 2)
|
||||
def test_follow_all_output_options_used_for_redirects(httpbin):
|
||||
r = http('--check-status',
|
||||
'--follow',
|
||||
'--all',
|
||||
'--print=H',
|
||||
httpbin.url + '/redirect/2')
|
||||
assert r.count('GET /') == 3
|
||||
assert HTTP_OK not in r
|
||||
|
||||
|
||||
def test_follow_redirect_output_options(httpbin):
|
||||
r = http('--check-status',
|
||||
'--follow',
|
||||
'--all',
|
||||
'--print=h',
|
||||
'--print-others=H',
|
||||
httpbin.url + '/redirect/2')
|
||||
assert r.count('GET /') == 2
|
||||
assert 'HTTP/1.1 302 FOUND' not in r
|
||||
assert HTTP_OK in r
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user