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
455 stars 51 forks source link

content negotiation in gddo doesnt work for parameters #30

Closed jdamick closed 7 years ago

jdamick commented 7 years ago

The content type negotiation in gddo doesnt properly respect parameters. It only looks for "q" and if it finds other params it doesn't properly parse the accept header.. see: https://github.com/golang/gddo/blob/master/httputil/header/header.go#L185

Since the parseaccept is called from within the negotiation there is really no good way to feed it a properly parsed accept so i just reimplemented it myself and to make sure the parameters are matched.

You can add back the old call to see the failure.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 94.643% when pulling 40c8d84e7b04932e3bcf1e0a6799ef7a7661c91d on jdamick:master into 1ab9d32f24c5442e77abc245ff3f5898afda99e7 on go-ozzo:master.

qiangxue commented 7 years ago

👍 Thanks!