forked from extern/httpie-cli
Fix printing redirected prepared request in verbose mode (#1088)
This commit is contained in:
parent
1470ca0c77
commit
2d55c01c7e
@ -177,8 +177,8 @@ def program(args: argparse.Namespace, env: Environment) -> ExitStatus:
|
||||
if is_request:
|
||||
if not initial_request:
|
||||
initial_request = message
|
||||
is_streamed_upload = not isinstance(message.body, (str, bytes))
|
||||
if with_body:
|
||||
is_streamed_upload = not isinstance(message.body, (str, bytes))
|
||||
do_write_body = not is_streamed_upload
|
||||
force_separator = is_streamed_upload and env.stdout_isatty
|
||||
else:
|
||||
|
@ -2,6 +2,7 @@
|
||||
import pytest
|
||||
|
||||
from httpie.status import ExitStatus
|
||||
from .fixtures import FILE_PATH_ARG
|
||||
from .utils import http, HTTP_OK
|
||||
|
||||
|
||||
@ -57,3 +58,19 @@ def test_max_redirects(httpbin):
|
||||
tolerate_error_exit_status=True,
|
||||
)
|
||||
assert r.exit_status == ExitStatus.ERROR_TOO_MANY_REDIRECTS
|
||||
|
||||
|
||||
def test_http_307_allow_redirect_post(httpbin):
|
||||
r = http('--follow', 'POST', httpbin.url + '/redirect-to',
|
||||
f'url=={httpbin.url}/post', 'status_code==307',
|
||||
'@' + FILE_PATH_ARG)
|
||||
assert HTTP_OK in r
|
||||
|
||||
|
||||
def test_http_307_allow_redirect_post_verbose(httpbin):
|
||||
r = http('--follow', '--verbose', 'POST', httpbin.url + '/redirect-to',
|
||||
f'url=={httpbin.url}/post', 'status_code==307',
|
||||
'@' + FILE_PATH_ARG)
|
||||
assert r.count('POST /redirect-to') == 1
|
||||
assert r.count('POST /post') == 1
|
||||
assert HTTP_OK in r
|
||||
|
Loading…
Reference in New Issue
Block a user