Skip to content

non-2xx (including 5xx) responses are being cached #341

Open
@benarmston

Description

@benarmston

When cachePolicy is set to cache-first, non-2xx responses are cached. I want to be able to avoid caching non-2xx response.

The codesandbox uses a 404 response as that is what was easiest for me to use there. However, the actual issue I ran into was with a 503 response. Caching 5xx responses is a bad idea.

** Codesandbox **

https://codesandbox.io/s/kind-christian-x2he1?file=/src/App.js

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/kind-christian-x2he1?file=/src/App.js
  2. Look in the console
  3. See that the 404 response was cached.

Expected behavior

Either non-2xx responses do not get cached; or there should be an option so that only 2xx responses are cached.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions