From 792f9d4585cd595fe793c5a667201626a040b6ce Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Tue, 20 Mar 2018 22:17:57 +0100 Subject: [PATCH] Document 'cacheSave' and 'cacheLoad' These functions are not part of Superagent so we should document them seperately. --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index 6fe5282..b871902 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,39 @@ possible to overwrite cookies marked as *HttpOnly*. Attempts to overwrite these This function will clear all saved cookies including those marked as *HttpOnly*. +## cacheSave(boolean) + +This function is set to override the cache save behavior for a single request. Setting it to `true` will enable +caching, while `false` implies the response will not be cached. + +``` + Http.Request + .get("http://httpbin.org/cache/3") + .cacheSave(false) + .end(function(err, res) { + // ... + }); + +``` + +## cacheLoad(Http.CacheControl) + +This function is set to override the cache behavior for a single request. It can have the following values: + * `Http.CacheControl.AlwaysNetwork` + * `Http.CacheControl.PreferNetwork` (default) + * `Http.CacheControl.PreferCache` + * `Http.CacheControl.AlwaysCache` + +``` + Http.Request + .get("http://httpbin.org/cache/3") + .cacheLoad(Http.CacheControl.AlwaysNetwork) + .end(function(err, res) { + // ... + }); + +``` + # Promise API This package contains an implementation of the [Promises/A+](https://promisesaplus.com/) specification and also