Skip to content

Comments

Fix MockResponse.getheaders not returning header values#7214

Open
bysiber wants to merge 1 commit intopsf:mainfrom
bysiber:fix/mock-response-getheaders-return
Open

Fix MockResponse.getheaders not returning header values#7214
bysiber wants to merge 1 commit intopsf:mainfrom
bysiber:fix/mock-response-getheaders-return

Conversation

@bysiber
Copy link

@bysiber bysiber commented Feb 20, 2026

MockResponse.getheaders() calls self._headers.getheaders(name) but doesn't return the result. The method always returns None regardless of what headers are present.

This method is part of the interface expected by http.cookiejar.CookieJar for extracting cookies from responses. While the current cookie extraction path goes through MockResponse.info()HTTPMessage, getheaders() is part of the public contract of MockResponse and any code relying on it would silently get None instead of the actual header values.

The fix adds the missing return statement.

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.

1 participant