Home / Function/ test_fragment_not_sent_with_request() — requests Function Reference

test_fragment_not_sent_with_request() — requests Function Reference

Architecture documentation for the test_fragment_not_sent_with_request() function in test_lowlevel.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  2d9720c7_50d4_7692_c827_1b8cc9787848["test_fragment_not_sent_with_request()"]
  48561d17_8bd1_bf20_5710_ec3053a534d2["test_lowlevel.py"]
  2d9720c7_50d4_7692_c827_1b8cc9787848 -->|defined in| 48561d17_8bd1_bf20_5710_ec3053a534d2
  style 2d9720c7_50d4_7692_c827_1b8cc9787848 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_lowlevel.py lines 342–361

def test_fragment_not_sent_with_request():
    """Verify that the fragment portion of a URI isn't sent to the server."""
    close_server = threading.Event()
    server = Server(echo_response_handler, wait_to_close_event=close_server)

    with server as (host, port):
        url = f'http://{host}:{port}/path/to/thing/#view=edit&token=hunter2'
        r = requests.get(url)
        raw_request = r.content

        assert r.status_code == 200
        headers, body = raw_request.split(b'\r\n\r\n', 1)
        status_line, headers = headers.split(b'\r\n', 1)

        assert status_line == b'GET /path/to/thing/ HTTP/1.1'
        for frag in (b'view', b'edit', b'token', b'hunter2'):
            assert frag not in headers
            assert frag not in body

        close_server.set()

Domain

Subdomains

Frequently Asked Questions

What does test_fragment_not_sent_with_request() do?
test_fragment_not_sent_with_request() is a function in the requests codebase, defined in tests/test_lowlevel.py.
Where is test_fragment_not_sent_with_request() defined?
test_fragment_not_sent_with_request() is defined in tests/test_lowlevel.py at line 342.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free