-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
31 lines (31 loc) · 817 Bytes
/
doc.go
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
// Package etag provides valid strong & weak etag generation.
//
// Example Usage
//
// The following is a complete example of a http.Handler
// import (
// "net/http
// "encoding/json"
//
// "github.com/hhsnopek/etag"
// )
//
// type Foo struct {
// Bar string `json:"bar"`
// }
//
// func FooHandler(w http.ResponseWriter, r *http.Request) {
// body, err := json.Marshal(&Foo{Bar: "baz"})
// if err != nil {
// http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
// return
// }
//
// e := etag.Generate(body, true)
// w.Header().Set("Content-Type", "application/json")
// w.Header().Set("Etag", e)
// w.WriteHeader(http.StatusOK)
// w.Write(body)
// return
// }
package etag