Beispiel #1
0
def test_request_headers_encoding():
    raw_headers = MockHTTPMessage({
        'x-foo': ['foo'],
        'x-bar': ['bar1', 'bar2'],
    })
    headers = RequestHeaders(raw_headers)
    assert isinstance(headers['x-foo'], bytes)
    assert isinstance(headers['x-bar'], bytes)
    assert isinstance(headers.get_list('x-bar')[0], bytes)
Beispiel #2
0
def test_request_headers_get():
    raw_headers = MockHTTPMessage({
        'x-foo': ['foo'],
        'x-bar': ['bar1', 'bar2'],
    })
    headers = RequestHeaders(raw_headers)
    assert headers['x-foo'] == b'foo'
    assert headers['X-Bar'] == b'bar1, bar2'
    assert headers.get('x-bar') == b'bar1, bar2'