}
 
 func (m Type) hasSuffix(suffix string) bool {
-       return strings.Contains(m.suffixesCSV, suffix)
+       return strings.Contains(","+m.suffixesCSV+",", ","+suffix+",")
 }
 
 // GetByMainSubType gets a media type given a main and a sub type e.g. "text" and "plain".
 
 
 import (
        "encoding/json"
+       "sort"
        "testing"
 
        qt "github.com/frankban/quicktest"
 
 func TestGetFirstBySuffix(t *testing.T) {
        c := qt.New(t)
-       _, f, found := DefaultTypes.GetFirstBySuffix("xml")
-       c.Assert(found, qt.Equals, true)
-       c.Assert(f, qt.Equals, SuffixInfo{
-               Suffix:     "xml",
-               FullSuffix: ".xml"})
+
+       types := DefaultTypes
+
+       // Issue #8406
+       geoJSON := newMediaTypeWithMimeSuffix("application", "geo", "json", []string{"geojson", "gjson"})
+       types = append(types, geoJSON)
+       sort.Sort(types)
+
+       check := func(suffix string, expectedType Type) {
+               t, f, found := types.GetFirstBySuffix(suffix)
+               c.Assert(found, qt.Equals, true)
+               c.Assert(f, qt.Equals, SuffixInfo{
+                       Suffix:     suffix,
+                       FullSuffix: "." + suffix})
+               c.Assert(t, qt.Equals, expectedType)
+       }
+
+       check("js", JavascriptType)
+       check("json", JSONType)
+       check("geojson", geoJSON)
+       check("gjson", geoJSON)
+
 }
 
 func TestFromTypeString(t *testing.T) {