Jump to solution
Details

The Fix

Upgrade to version 0.15.0 or later.

Based on closed encode/httpx issue #1227 · PR/commit linked

Open PR/Commit
@@ -1,6 +1,15 @@ @@ -1,6 +1,15 @@ import inspect -import typing from json import dumps as json_dumps +from typing import (
fix.md
Option A — Upgrade to fixed release\nUpgrade to version 0.15.0 or later.\nWhen NOT to use: This fix should not be used if backward compatibility with existing Response instantiation is critical.\n\n

Why This Fix Works in Production

  • Trigger: * Make the `request` parameter become optional. Have a `.request` property that returns a `Request` instance or raises a RuntimeError if the instance is not…
  • Mechanism: The Response class required mandatory parameters that limited instantiation flexibility
  • Why the fix works: Adds support for instantiating Response instances directly with parameters like text, html, and json, addressing issue #1227. (first fixed release: 0.15.0).

Why This Breaks in Prod

  • The Response class required mandatory parameters that limited instantiation flexibility
  • Production symptom (often without a traceback): * Make the `request` parameter become optional. Have a `.request` property that returns a `Request` instance or raises a RuntimeError if the instance is not set. Have a property setter for the `.request` property.

Proof / Evidence

  • GitHub issue: #1227
  • Fix PR: https://github.com/encode/httpx/pull/1297
  • First fixed release: 0.15.0
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.75
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.79

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“If any contributors want to take a go at this I'd suggest approaching it in parts..”
@lovelydinosaur · 2020-08-27 · source
“Great. Definitely treat each of those items in isolation as separate PRs. 😀”
@lovelydinosaur · 2020-08-27 · source
“The issue is quite detailed thanks for that. 😄 I don't have much experience with httpx but would love to give it a try.”
@Pradhvan · 2020-08-27 · source

Failure Signature (Search String)

  • * Make the `request` parameter become optional. Have a `.request` property that returns a `Request` instance or raises a RuntimeError if the instance is not set. Have a property
Copy-friendly signature
signature.txt
Failure Signature ----------------- * Make the `request` parameter become optional. Have a `.request` property that returns a `Request` instance or raises a RuntimeError if the instance is not set. Have a property setter for the `.request` property.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- * Make the `request` parameter become optional. Have a `.request` property that returns a `Request` instance or raises a RuntimeError if the instance is not set. Have a property setter for the `.request` property.

What Broke

Unit tests for custom auth classes were difficult to implement due to rigid Response instantiation.

Why It Broke

The Response class required mandatory parameters that limited instantiation flexibility

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

Upgrade to version 0.15.0 or later.

When NOT to use: This fix should not be used if backward compatibility with existing Response instantiation is critical.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/encode/httpx/pull/1297

First fixed release: 0.15.0

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix should not be used if backward compatibility with existing Response instantiation is critical.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
  • Upgrade behind a canary and run integration tests against the canary before 100% rollout.

Version Compatibility Table

VersionStatus
0.15.0 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.