Preflight checks

April 25, 2018 ยท View on GitHub

Before performing a request, the library will check whether it should, based on logic and cache control.

Should perform

Here are the conditions that would immediately cancel a request:

Request methodConditionExplanation
GETAn identical request (same URL, same query parameters) is already performingWe will receive the payload of the first request sooner than the payload of the second, and there is no reason they should differ
POSTAn identical request (same URL) is already performingWe didn't find a way to effectively monitor POST requests. For a given resource, they have the same URL, and often the same body. However, tou can use cache hints to differentiate multiple POST requests with the same URL
PATCHAn identical request (same URL) is already performingThe second request might be based on outdated info, which will be updated when we receive the payload of the first request
PUTAn identical request (same URL) is already performingSame as for PATCH
DELETEAn identical request (same URL) is already performingA resource can only be deleted once

Cache control

And here are the conditions that would cancel a request based on cache control:

Request methodCondition
GET- The exact same request has succeeded and its cache is still valid
- The request is about a resource/id pair which has already been retrieved, and the cache is still valid
POSTNo cache
PATCHNo cache
PUTNo cache
DELETENo cache