go-ozzo / ozzo-routing

An extremely fast Go (golang) HTTP router that supports regular expression route matching. Comes with full support for building RESTful APIs.
MIT License
453 stars 51 forks source link

Fix negotiateContentType , if not match, the default should used #66

Closed ghost closed 3 years ago

ghost commented 3 years ago

If no match is found, the default should be used, to not break the behavior of TypeNegotiator(formats ...string) https://github.com/go-ozzo/ozzo-routing/blob/master/content/type.go#L44.

// TypeNegotiator returns a content type negotiation handler.
//
// The method takes a list of response MIME types that are supported by the application.
// The negotiator will determine the best response MIME type to use by checking the "Accept" HTTP header.
// If no match is found, the first MIME type will be used.