Permalink
Fetching contributors…
Cannot retrieve contributors at this time
17 lines (14 sloc) 305 Bytes
package resource
import (
"crypto/md5"
"encoding/json"
"fmt"
)
// Etag computes an etag based on containt of the payload.
func genEtag(payload map[string]interface{}) (string, error) {
b, err := json.Marshal(payload)
if err != nil {
return "", err
}
return fmt.Sprintf("%x", md5.Sum(b)), nil
}