RepoProof

TEST RECORD / HTXCLN

Httpx tested on Ubuntu: what our test showed

Short answer

The recorded run of httpx 0.28.1 on Ubuntu under WSL2 finished with exit code 0 and produced the output shown below. Compare input and output yourself; we add no reading the record cannot back up.

  • Not covered: anything beyond this one input, version and setup. The project states a limit of its own; see Limits of this test.
  • Tested: httpx 0.28.1 on Ubuntu under WSL2, .

Test HTTP without a real server.

Visit official site ↗

A direct, non-affiliate link to the official project.

What is httpx?

Test HTTP without a real server.

Test HTTP without a real server.

Apart from marked quotes, everything on this page comes from our own test run.

How we tested httpx

We ran httpx 0.28.1 on (UTC) in an isolated sandbox: Ubuntu under WSL2. Networking was switched off, so nothing was downloaded or sent during the test. The test ran as an unprivileged user with an empty home directory.

Sandbox checks recorded before the run, all passed: network disabled, home directory blocked, secrets blocked, writes limited to the test workspace.

Setup as recorded: WSL2 sandbox: no network, read-only root, nobody user; verified installed release and dependencies.

  1. The input file example.py (254 bytes) was placed in an empty workspace.
  2. We ran bin/test example.py. It exited with code 0.
  3. We kept the exact output (104 bytes) and compared it with the input byte for byte.
  4. The terminal session was recorded (6.72 seconds).

bin/test is defined by the test definition in our repository (config/curation/httpx-0.28.1.json), shown below as it stood when this page was built. The script itself is not part of the hashed test record, unlike the input, output and command above.

#!/usr/bin/python3 -I
import contextlib
import io
import sys
import time
START = time.perf_counter()
sys.path.insert(0, "/tmp/ws")
OUT = []
def check(label, test):
    try:
        ok = bool(test())
    except BaseException as exc:
        ok = False
        print("check %r raised %s" % (label, type(exc).__name__), file=sys.stderr)
    OUT.append((ok, label))
def raises(error, action):
    try:
        action()
    except error:
        return True
    return False
N = {"__name__": "curated_example"}
try:
    with contextlib.redirect_stdout(io.StringIO()):
        exec(compile(open(sys.argv[1], encoding="utf-8").read(), sys.argv[1], "exec"), N)
except BaseException as exc:
    print("Example failed: " + type(exc).__name__, file=sys.stderr)
check('HTTPX status', lambda: N["status"] == 200)
check('HTTPX JSON', lambda: N["body"] == {"ok": True})
check('HTTPX request path', lambda: N["path"] == "/hello")
check('HTTPX closed client', lambda: N["client"].is_closed)
for ok, label in OUT:
    print(("PASS " if ok else "FAIL ") + label)
print("%d/%d passed in %.2f s" % (sum(o for o, _ in OUT), len(OUT), time.perf_counter() - START))

What we saw

What we tried: Local documented API adaptation: HTTPX status, HTTPX JSON, HTTPX request path, HTTPX closed client.

What went in: 9 lines of text (254 bytes).

What came out: 5 lines of text (104 bytes).

Exact recorded input and output. Invisible characters are written out (for example \x1b is the escape character) so you can see them.

Before (input)
import httpx
def reply(request):
  return httpx.Response(200,json={"ok":True})
t=httpx.MockTransport(reply)
with httpx.Client(transport=t) as client:
  r=client.get("https://demo.invalid/hello")
status=r.status_code
body=r.json()
path=r.request.url.path
After (output)
PASS HTTPX status
PASS HTTPX JSON
PASS HTTPX request path
PASS HTTPX closed client
4/4 passed in 0.17 s

Measured result

Input size
254 bytes
Output size
104 bytes
Sandbox run time
8.62 seconds: the whole isolated sandbox run, including sandbox start-up. This is not the tool's own processing time.
Demo recording length
6.72 seconds

Recorded measurement: 4 of 4 README checks passed in 0.17 seconds.

Limits of this test

Only a mock transport ran; real connections and TLS were not tested.

This record covers one input, one version (0.28.1) and one platform (Ubuntu under WSL2). It is not a speed benchmark: the sandbox time includes start-up. We did not run it on Windows or macOS here, so results there may differ.

Is httpx a fit for you?

Questions this test answers

Did we test httpx on Windows?

No. This record ran on Ubuntu under WSL2. It does not show how httpx behaves in a Windows console.

Which version did we test, and when?

httpx 0.28.1, on (UTC).

Did the test need internet access?

No. The sandbox had networking switched off for the whole run.

What does httpx not handle?

Our single input does not probe this. The project names its own limit, quoted under Limits of this test; inputs like that need their own test.

Watch the test

Pressing play loads the YouTube player from youtube-nocookie.com; YouTube (Google) then applies its own privacy policy. Nothing is loaded from YouTube before you press play. Privacy

Watch on YouTube ↗

Transcript

Test HTTP without a real server.

It's a Python HTTP client with replaceable transports. Here is the repository and a three-clause BSD license.

Here is what it gives you: one, mock transport; two, json response; three, request path.

We ran the README example in a sandbox with no network: 4 checks in all.

Result: 4 of 4 checks passed in 0.17 seconds.

Our verdict: it works. One honest limit: only a mock transport ran; real connections and TLS were not tested.

Full test results are in the Tools link on our profile.

Test records

Each test keeps the code shown in its video. Code HTXCLN leads here; you can also search any code on Find a code.

CodeTestedVersionPlatformResult
HTXCLN0.28.1Ubuntu under WSL2see record

Official links

Related tools we tested

License and attribution

  • BSD-3-Clause — httpx by encode (BSD-3-Clause)
    Rights holder: encode. Permission: use_modify_distribute License source ↗
  • LicenseRef-RepoProof-Owned — RepoProof
    Rights holder: RepoProof. Permission: use_modify_distribute License source ↗
    Covers 6 assets: demo input, demo output, demo recording, input frame, output frame, demo extra checks json.

Production note

AI-assisted script and synthetic narration; demo recorded by our automated test workflow.

Page text is assembled from the recorded test data. Sentences taken from the tool's README are marked as quotes.

Find the code from a video