finagle / finch

Scala combinator library for building Finagle HTTP services
https://finagle.github.io/finch
Apache License 2.0
1.6k stars 221 forks source link

Add quality factors to content negotiation #1059

Open ThijsBroersen opened 5 years ago

ThijsBroersen commented 5 years ago

As a user I would also like quality factors within an Accept-header to be respected. E.g.

Input
  .get("/test")
  .withHeaders("Accept" -> "text/plain;q=0.3,application/json;q=0.9")

Currently the quality factors are ignored.

vkostyukov commented 5 years ago

@ThijsBroersen Thanks for the ticket!

Not sure I follow the first part about being a multi-value. This should be supported (only qualities are ignored) and if not, it's a bug. Mind providing more details on this?

ThijsBroersen commented 5 years ago

@vkostyukov you are correct, it takes the first Content-Type that matches any value from the Accept-header. And when no match is found it returns the last Content-Type of a coproduct. My tests were a bit off...