Skip to content

[3.8] Eliminate side-effects from the ClientResponse.ok property#5407

Merged
webknjaz merged 1 commit intoaio-libs:3.8from
adamko147:backport-3250c5d-3.8
Feb 1, 2021
Merged

[3.8] Eliminate side-effects from the ClientResponse.ok property#5407
webknjaz merged 1 commit intoaio-libs:3.8from
adamko147:backport-3250c5d-3.8

Conversation

@adamko147
Copy link
Copy Markdown
Contributor

This change makes it so accessing ClientResponse.ok only does the status
code check.

Prior to this commit, it'd call ClientResponse.raise_for_status() which
in turn, closed the underlying TCP session whenever the status was 400 or
higher making it effectively impossible to keep working with the response,
including reading the HTTP response payload.

PR #5404 by @adamko147

Fixes #5403

Co-authored-by: Sviatoslav Sydorenko [email protected]
(cherry picked from commit 3250c5d)

Co-authored-by: Adam Horacek [email protected]

What do these changes do?

Are there changes in behavior for the user?

Related issue number

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the CHANGES folder
    • name it <issue_id>.<type> for example (588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the pr
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."

This change makes it so accessing `ClientResponse.ok` only does the status
code check.

Prior to this commit, it'd call `ClientResponse.raise_for_status()` which
in turn, closed the underlying TCP session whenever the status was 400 or
higher making it effectively impossible to keep working with the response,
including reading the HTTP response payload.

PR #5404 by @adamko147

Fixes #5403

Co-authored-by: Sviatoslav Sydorenko <[email protected]>
(cherry picked from commit 3250c5d)

Co-authored-by: Adam Horacek <[email protected]>
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Jan 14, 2021
Copy link
Copy Markdown
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

Thanks!

@webknjaz
Copy link
Copy Markdown
Member

FTR GitHub seems to be having trouble merging PRs right now. I'll have to revisit this and try merging later.

@adamko147
Copy link
Copy Markdown
Contributor Author

No problem. Thanks for the support to make this fix!

@adamko147
Copy link
Copy Markdown
Contributor Author

@webknjaz do you mind merge this, please? Thanks!

@webknjaz webknjaz merged commit 9a09d1b into aio-libs:3.8 Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants