This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
New: Use ETAG in header for reading releases from the cache #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the purpose of this pull request? (put an "X" next to item)
[] Documentation update
[] Bug fix
[x] New functionality
[] Changes an existing functionality
[] Other, please explain:
What changes did you make? (Give an overview)
An HTTP call to retrieve the releases does not use any authentication, as a result of this there is a rate limit of how much requests can be made. To solve a problem, I decided to capture the ETAG from the first retrieve releases request that is returned with a status of 200. The response of this request is cached in a
localStorage
. And then use this ETAG in the subsequent requests for retrieving releases. If the resource (releases data) has not changed then the github API server will return with 304-status and no response. In this situation we will return the cached version of data.Add any screenshots
localStorage
used for storing releases data and ETAGI refreshed the page and you can see
releases
returned with 304When clicked the versions chip then also
releases
returned with 304 because resource is not changed