From 7bd9f970a765098287d1bed1506fbfa85bc58928 Mon Sep 17 00:00:00 2001 From: gulgulia17 <44695294+gulgulia17@users.noreply.github.com> Date: Wed, 6 Jul 2022 16:40:28 +0530 Subject: [PATCH 1/2] Clarification Added More details added a better understanding, of how it works. --- _includes/api/en/4x/req-fresh.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/_includes/api/en/4x/req-fresh.md b/_includes/api/en/4x/req-fresh.md index 1b6ec61c59..b34e170429 100644 --- a/_includes/api/en/4x/req-fresh.md +++ b/_includes/api/en/4x/req-fresh.md @@ -2,12 +2,19 @@ When the response is still "fresh" in the client's cache `true` is returned, otherwise `false` is returned to indicate that the client cache is now stale and the full response should be sent. +In order to check weather the response is still "fresh" in the client's cache or not, 2 Tags will be used ETag and If-None-Match, ETag will be fetched from response (saved internally from application) and other tag will be recieved from client's request. + When a client sends the `Cache-Control: no-cache` request header to indicate an end-to-end reload request, this module will return `false` to make handling these requests transparent. Further details for how cache validation works can be found in the [HTTP/1.1 Caching Specification](https://tools.ietf.org/html/rfc7234). ```js + +// Get value for ETag where you saved it initially, In general you +// may use a file to store timestamps with API request name + +res.set('ETag', "foo") console.dir(req.fresh) // => true ``` From 2f0924420de7a9dd7ab7f7191b7e24afa84e0938 Mon Sep 17 00:00:00 2001 From: gulgulia17 <44695294+gulgulia17@users.noreply.github.com> Date: Thu, 7 Jul 2022 05:53:12 +0530 Subject: [PATCH 2/2] Update _includes/api/en/4x/req-fresh.md Co-authored-by: Nirav <61644078+srkds@users.noreply.github.com> --- _includes/api/en/4x/req-fresh.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/api/en/4x/req-fresh.md b/_includes/api/en/4x/req-fresh.md index b34e170429..ae4ebdda0c 100644 --- a/_includes/api/en/4x/req-fresh.md +++ b/_includes/api/en/4x/req-fresh.md @@ -2,7 +2,7 @@ When the response is still "fresh" in the client's cache `true` is returned, otherwise `false` is returned to indicate that the client cache is now stale and the full response should be sent. -In order to check weather the response is still "fresh" in the client's cache or not, 2 Tags will be used ETag and If-None-Match, ETag will be fetched from response (saved internally from application) and other tag will be recieved from client's request. +In order to check whether the response is still "fresh" in the client's cache or not, two tags will be used ETag and If-None-Match. ETag will be fetched from response (saved internally from application) and other tag will be received from client's request. When a client sends the `Cache-Control: no-cache` request header to indicate an end-to-end reload request, this module will return `false` to make handling these requests transparent.