Baseflow / flutter_cache_manager

Generic cache manager for flutter
https://baseflow.com
MIT License
740 stars 429 forks source link

Don't add `if-none-match` header manually #304

Closed sidrao2006 closed 3 years ago

sidrao2006 commented 3 years ago

:sparkles: What kind of change does this PR introduce? (Bug fix, feature, docs update...)

Bugfix / Caching strategy update

:arrow_heading_down: What is the current behavior?

If eTag is returned by the server, if-none-match header is added on subsequent requests which -

  1. Triggers preflight requests
  2. Throws CORS error as the server doesn't support manually added if-none-match headers

:new: What is the new behavior (if this is a feature change)?

if-none-match is not added manually. The browser handles this for us.

:boom: Does this PR introduce a breaking change?

No

:bug: Recommendations for testing

If tests try matching request headers, remove if-none-match from the list.

:memo: Links to relevant issues/docs

web.dev article on how the browser handles eTags and adding required headers for the same.

Closes #316

:thinking: Checklist before submitting

sidrao2006 commented 3 years ago

cc @renefloor

renefloor commented 3 years ago

@sidrao2006 did you see my suggestion in the comment? https://github.com/Baseflow/flutter_cache_manager/pull/304#discussion_r607573131

I think we should only skip sending the eTag while using web, as that is handled by the browser and not by the httpclient on mobile or desktop.

sidrao2006 commented 3 years ago

Sorry, missed it

sidrao2006 commented 3 years ago

cc @renefloor

renefloor commented 3 years ago

Sorry, I've been busy

sidrao2006 commented 3 years ago

Sorry, I've been busy

No problem, thanks for merging the PR