File: README.md

package info (click to toggle)
golang-github-lestrrat-go-httpcc 1.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 104 kB
  • sloc: makefile: 2
file content (35 lines) | stat: -rw-r--r-- 902 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
httpcc
======

Parses HTTP/1.1 Cache-Control header, and returns a struct that is convenient
for the end-user to do what they will with.

# Parsing the HTTP Request

```go
dir, err := httpcc.ParseRequest(req.Header.Get(`Cache-Control`))
// dir.MaxAge()       uint64, bool
// dir.MaxStale()     uint64, bool
// dir.MinFresh()     uint64, bool
// dir.NoCache()      bool
// dir.NoStore()      bool
// dir.NoTransform()  bool
// dir.OnlyIfCached() bool
// dir.Extensions()   map[string]string
```

# Parsing the HTTP Response

```go
directives, err := httpcc.ParseResponse(res.Header.Get(`Cache-Control`))
// dir.MaxAge()         uint64, bool
// dir.MustRevalidate() bool
// dir.NoCache()        []string
// dir.NoStore()        bool
// dir.NoTransform()    bool
// dir.Public()         bool
// dir.Private()        bool
// dir.SMaxAge()        uint64, bool
// dir.Extensions()     map[string]string
```