github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/pkg/httputil/formats.go (about) 1 package httputil 2 3 import ( 4 "strings" 5 "time" 6 ) 7 8 const ( 9 // DateHeaderTimestampFormat - Last-Modified: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT 10 DateHeaderTimestampFormat = "Mon, 02 Jan 2006 15:04:05 GMT" 11 ) 12 13 func HeaderTimestamp(ts time.Time) string { 14 return ts.UTC().Format(DateHeaderTimestampFormat) 15 } 16 17 func ETag(checksum string) string { 18 if strings.HasPrefix(checksum, `"`) { 19 return checksum 20 } 21 return `"` + checksum + `"` 22 } 23 24 func StripQuotesAndSpaces(etag string) string { 25 return strings.TrimFunc(etag, func(r rune) bool { 26 return r == '"' || r == ' ' 27 }) 28 }