initial commits
parent
76045c518f
commit
31110d58c2
|
@ -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.
|
||||
}
|
Loading…
Reference in New Issue