Micropub endpoint for my blog https://jlelse.blog/posts/hugo-micropub/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

25 lines
606 B

package main
import (
"testing"
)
func TestGetContentType(t *testing.T) {
for key, value := range map[string]ContentType{
"": UnsupportedType,
"test": UnsupportedType,
"application/x-www-form-urlencoded": WwwForm,
"application/json": Json,
"multipart/form-data": Multipart,
} {
t.Run(key, func(t *testing.T) {
got, err := GetContentType(key)
if got != value {
t.Errorf("Wrong ContentType")
}
if value == UnsupportedType && err == nil {
t.Errorf("Error is nil")
}
})
}
}