internal: fix ETag.String returning unquoted string

This commit is contained in:
Simon Ser 2020-02-03 21:52:15 +01:00
parent 25678476db
commit 69d8cf54ff
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -356,12 +356,12 @@ func (etag *ETag) UnmarshalText(b []byte) error {
return nil return nil
} }
func (etag *ETag) MarshalText() ([]byte, error) { func (etag ETag) MarshalText() ([]byte, error) {
return []byte(fmt.Sprintf("%q", *etag)), nil return []byte(etag.String()), nil
} }
func (etag ETag) String() string { func (etag ETag) String() string {
return string(etag) return fmt.Sprintf("%q", string(etag))
} }
// https://tools.ietf.org/html/rfc4918#section-14.5 // https://tools.ietf.org/html/rfc4918#section-14.5