Skip to content

interceptors/urllib3: return version and version_string in response#176

Merged
sarayourfriend merged 1 commit intoh2non:masterfrom
xrmx:urllib3-version
Mar 11, 2026
Merged

interceptors/urllib3: return version and version_string in response#176
sarayourfriend merged 1 commit intoh2non:masterfrom
xrmx:urllib3-version

Conversation

@xrmx
Copy link
Contributor

@xrmx xrmx commented Mar 9, 2026

Description

Add missing version and a version_string that are available in urllib3 response:

>>> import urllib3
>>> resp = urllib3.request("GET", "https://httpbin.org/robots.txt")
>>> resp.version
11
>>> resp.version_string
'HTTP/1.1'

PR Checklist

  • I've added tests for any code changes
  • I've documented any new features

>>> import urllib3
>>> resp = urllib3.request("GET", "https://httpbin.org/robots.txt")
>>> resp.version
11
>>> resp.version_string
'HTTP/1.1'
reason=http_reasons.get(res._status),
original_response=FakeResponse(method, headers),
version=11,
version_string="HTTP/1.1",
Copy link
Contributor Author

@xrmx xrmx Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is urllib3>=2 but I don't think it would be a problem for people still mocking urllib3<2

@sarayourfriend sarayourfriend merged commit c7dcf2d into h2non:master Mar 11, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants