github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/pkg/httputils/mimetype_test.go (about)

     1  package httputils
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestDetectContentType(t *testing.T) {
     8  	input := []byte("That is just a plain text")
     9  
    10  	if contentType, _, err := DetectContentType(input); err != nil || contentType != "text/plain" {
    11  		t.Error("TestDetectContentType failed")
    12  	}
    13  }