https://github.com/lestrrat-go/httpcc
HTTP/1.1 Cache-Control Header Parser
https://github.com/lestrrat-go/httpcc
Last synced: about 2 months ago
JSON representation
HTTP/1.1 Cache-Control Header Parser
- Host: GitHub
- URL: https://github.com/lestrrat-go/httpcc
- Owner: lestrrat-go
- License: mit
- Created: 2020-12-30T11:01:55.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-29T07:47:41.000Z (about 3 years ago)
- Last Synced: 2024-06-19T02:09:33.275Z (about 1 year ago)
- Language: Go
- Size: 12.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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
```