Home / Function/ test_json_encodes_as_bytes() — requests Function Reference

test_json_encodes_as_bytes() — requests Function Reference

Architecture documentation for the test_json_encodes_as_bytes() function in test_requests.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  d9f6494d_3a76_fe40_2550_baf3bfbb64d8["test_json_encodes_as_bytes()"]
  69ebfd6f_8f0c_4586_0c19_2c348e1a42a2["test_requests.py"]
  d9f6494d_3a76_fe40_2550_baf3bfbb64d8 -->|defined in| 69ebfd6f_8f0c_4586_0c19_2c348e1a42a2
  style d9f6494d_3a76_fe40_2550_baf3bfbb64d8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_requests.py lines 2586–2591

def test_json_encodes_as_bytes():
    # urllib3 expects bodies as bytes-like objects
    body = {"key": "value"}
    p = PreparedRequest()
    p.prepare(method="GET", url="https://www.example.com/", json=body)
    assert isinstance(p.body, bytes)

Domain

Subdomains

Frequently Asked Questions

What does test_json_encodes_as_bytes() do?
test_json_encodes_as_bytes() is a function in the requests codebase, defined in tests/test_requests.py.
Where is test_json_encodes_as_bytes() defined?
test_json_encodes_as_bytes() is defined in tests/test_requests.py at line 2586.

Analyze Your Own Codebase

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

Try Supermodel Free