Skip to content

Commit

Permalink
Document 'cacheSave' and 'cacheLoad'
Browse files Browse the repository at this point in the history
These functions are not part of Superagent so we should document them
seperately.
  • Loading branch information
jrbarron committed Mar 20, 2018
1 parent 83e7986 commit 792f9d4
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 792f9d4

Please sign in to comment.