Skip to content

[BUG]: Failed API calls update response cache #2876

@daverant

Description

@daverant

What happened?

The response cache in CachingHttpClient is called even when GitHub returns a non-2xx and non-304 status code. It's likely that implementations of IResponseCache will only want to cache data for successful responses. Without this check, it's easy for implementations to miss this check and flush valid responses from the cache when receiving a non-2xx response, resulting in an increase of subsequent cache misses.

This is an opinionated change - it's reasonable to expect implementations to cater for this themselves, but feels like it would help users more than hinder (I can't think of a use case for caching non-successful responses).

Versions

octokit.net v9.1.2, net7.0

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working as documented

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions