mirror of
https://github.com/httpie/cli.git
synced 2024-11-22 15:53:13 +01:00
Add --follow --verbose
test for HTTP 308
This commit is contained in:
parent
dc4309771e
commit
3228e74df5
@ -68,10 +68,18 @@ def test_http_307_allow_redirect_post(httpbin):
|
|||||||
assert HTTP_OK in r
|
assert HTTP_OK in r
|
||||||
|
|
||||||
|
|
||||||
def test_http_307_allow_redirect_post_verbose(httpbin):
|
@pytest.mark.parametrize('status_code', [307, 308])
|
||||||
r = http('--follow', '--verbose', 'POST', httpbin.url + '/redirect-to',
|
def test_verbose_follow_redirect_with_repost(httpbin, status_code):
|
||||||
f'url=={httpbin.url}/post', 'status_code==307',
|
# <https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections>
|
||||||
'@' + FILE_PATH_ARG)
|
r = http(
|
||||||
|
'--follow',
|
||||||
|
'--verbose',
|
||||||
|
httpbin.url + '/redirect-to',
|
||||||
|
f'url=={httpbin.url}/post',
|
||||||
|
f'status_code=={status_code}',
|
||||||
|
'@' + FILE_PATH_ARG,
|
||||||
|
)
|
||||||
|
assert f'HTTP/1.1 {status_code}' in r
|
||||||
assert r.count('POST /redirect-to') == 1
|
assert r.count('POST /redirect-to') == 1
|
||||||
assert r.count('POST /post') == 1
|
assert r.count('POST /post') == 1
|
||||||
assert r.count(FILE_CONTENT) == 3 # two requests + final response contain it
|
assert r.count(FILE_CONTENT) == 3 # two requests + final response contain it
|
||||||
|
Loading…
Reference in New Issue
Block a user