github.com/LazyboyChen7/engine@v17.12.1-ce-rc2+incompatible/api/server/httputils/httputils_test.go (about) 1 package httputils 2 3 import "testing" 4 5 // matchesContentType 6 func TestJsonContentType(t *testing.T) { 7 if !matchesContentType("application/json", "application/json") { 8 t.Fail() 9 } 10 11 if !matchesContentType("application/json; charset=utf-8", "application/json") { 12 t.Fail() 13 } 14 15 if matchesContentType("dockerapplication/json", "application/json") { 16 t.Fail() 17 } 18 }