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

  1. package main
  2. import (
  3. "testing"
  4. )
  5. func TestGetContentType(t *testing.T) {
  6. for key, value := range map[string]ContentType{
  7. "": UnsupportedType,
  8. "test": UnsupportedType,
  9. "application/x-www-form-urlencoded": WwwForm,
  10. "application/json": Json,
  11. "multipart/form-data": Multipart,
  12. } {
  13. t.Run(key, func(t *testing.T) {
  14. got, err := GetContentType(key)
  15. if got != value {
  16. t.Errorf("Wrong ContentType")
  17. }
  18. if value == UnsupportedType && err == nil {
  19. t.Errorf("Error is nil")
  20. }
  21. })
  22. }
  23. }