Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: use .read() instead of .content.read() in aiohttp transport#1899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
google-labs-jules wants to merge2 commits intomain
base:main
Choose a base branch
Loading
fromfix-aiohttp-cache-empty-response-3355868403646689815

Conversation

@google-labs-jules
Copy link

@google-labs-julesgoogle-labs-julesbot commentedDec 19, 2025
edited by chalmerlowe
Loading

Fixes issue where response content is empty when usingaiohttp-client-cache by usingresponse.read() instead ofresponse.content.read().

Rationale:
Inaiohttp,.read() is the standard, high-level method for reading the full response body. It correctly handles internal state (like caching the body for subsequent calls), which is essential for compatibility with wrappers likeaiohttp-client-cache. Accessing.content.read() directly bypasses this logic, leading to empty responses when the stream has already been consumed or intercepted by the caching layer.

Benefits:

  • Robustness: Ensures correct behavior whengoogle-auth is used in conjunction withaiohttp wrappers or middleware.
  • Standards: Aligns withaiohttp best practices for consuming response bodies.

Risk Mitigation:

  • Behavior:_CombinedResponse is designed to load the full response into memory. Changing to.read() preserves this behavior exactly; it just uses a safer accessor.
  • Performance: Sinceaiohttp's.read() returns a reference to the bytes, there is no additional memory overhead compared to the previous implementation.
  • Internal: This change is internal to the transport adapter and does not alter the public API or behavior for users not using caching libraries.

PR created automatically by Jules for task3355868403646689815 started by@chalmerlowe

Using .read() is more robust when working with caching libraries likeaiohttp-client-cache, which may cause .content.read() to return emptybytes on subsequent reads. .read() ensures the full body is returned.Fixes#1248
@google-labs-jules
Copy link
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me toReactive Mode. When this mode is on, I will only act on comments where you specifically mention me with@jules. You can find this option in thePull Request section of yourglobal Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more atjules.google/docs.

Using .read() is more robust when working with caching libraries likeaiohttp-client-cache, which may cause .content.read() to return emptybytes on subsequent reads. .read() ensures the full body is returned.Fixes#1248
@chalmerlowechalmerlowe marked this pull request as ready for reviewDecember 19, 2025 21:04
@chalmerlowechalmerlowe requested review froma team ascode ownersDecember 19, 2025 21:04
@chalmerlowechalmerlowe self-assigned thisDec 19, 2025
@chalmerlowechalmerlowe added the kokoro:runAdd this label to force Kokoro to re-run the tests. labelDec 19, 2025
@yoshi-kokoroyoshi-kokoro removed the kokoro:runAdd this label to force Kokoro to re-run the tests. labelDec 19, 2025
Copy link
Contributor

@chalmerlowechalmerlowe left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@daniel-sanchedaniel-sanche left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@daniel-sanchedaniel-sanchedaniel-sanche approved these changes

@chalmerlowechalmerlowechalmerlowe approved these changes

Assignees

@chalmerlowechalmerlowe

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@daniel-sanche@chalmerlowe@yoshi-kokoro

[8]ページ先頭

©2009-2025 Movatter.jp