1
0
Fork 0
datetime.link/mime_test.go

21 lines
616 B
Go

package main
import (
"testing"
)
func TestChooseResponseType(t *testing.T) {
r := chooseResponseType("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3")
if r != responseHTML {
t.Errorf("expecting html, got %v", r)
}
r = chooseResponseType("application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3")
if r != responseAny {
t.Errorf("expecting any, got %v", r)
}
r = chooseResponseType("text/plain;q=,text/html")
if r != responseHTML {
t.Errorf("expecting html, got %v", r)
}
}