initial commits

master
Charles Iliya Krempeaux 2023-08-11 12:09:18 -07:00
parent 76045c518f
commit 31110d58c2
1 changed files with 36 additions and 0 deletions

36
notacceptable.go 100644
View File

@ -0,0 +1,36 @@
package httpaccept
import (
"fmt"
"strings"
)
var _ error = &internalNotAcceptable{}
type internalNotAcceptable struct {
mediatypes []string
}
func (receiver internalNotAcceptable) Error() string {
var mediatypes []string = receiver.mediatypes
if len(mediatypes) < 1 {
return "httpaccept: none of the provided media-types are acceptable, because an empty list of media-types was provided"
}
var buffer strings.Builder
buffer.WriteString("httpaccept: none of the provided media-types are acceptable —")
for _, mediatype := range mediatypes {
fmt.Fprintf(&buffer, " %q", mediatype)
}
return buffer.String()
}
func (internalNotAcceptable) ClientError() {
// Nothing here.
}
func (internalNotAcceptable) NotAcceptable() {
// Nothing here.
}