2014-06-28 13:24:14 +02:00
|
|
|
"""Miscellaneous regression tests"""
|
2014-09-07 10:20:32 +02:00
|
|
|
import pytest
|
2014-06-28 13:24:14 +02:00
|
|
|
|
|
|
|
from utils import http, HTTP_OK
|
2014-09-07 10:20:32 +02:00
|
|
|
from httpie.compat import is_windows
|
2014-06-28 13:24:14 +02:00
|
|
|
|
|
|
|
|
2014-06-28 16:35:57 +02:00
|
|
|
def test_Host_header_overwrite(httpbin):
|
2014-06-28 13:24:14 +02:00
|
|
|
"""
|
2017-03-10 11:27:38 +01:00
|
|
|
https://github.com/jakubroztocil/httpie/issues/235
|
2014-06-28 13:24:14 +02:00
|
|
|
|
|
|
|
"""
|
|
|
|
host = 'httpbin.org'
|
2016-10-26 11:28:17 +02:00
|
|
|
url = httpbin.url + '/get'
|
2014-06-28 16:35:57 +02:00
|
|
|
r = http('--print=hH', url, 'host:{0}'.format(host))
|
2014-06-28 13:24:14 +02:00
|
|
|
assert HTTP_OK in r
|
|
|
|
assert r.lower().count('host:') == 1
|
2014-06-28 16:35:57 +02:00
|
|
|
assert 'host: {0}'.format(host) in r
|
2014-09-07 10:20:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.skipif(is_windows, reason='Unix-only')
|
|
|
|
def test_output_devnull(httpbin):
|
|
|
|
"""
|
2017-03-10 11:27:38 +01:00
|
|
|
https://github.com/jakubroztocil/httpie/issues/252
|
2014-09-07 10:20:32 +02:00
|
|
|
|
|
|
|
"""
|
|
|
|
http('--output=/dev/null', httpbin + '/get')
|