Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Accept.best_client_match #241

Closed
wants to merge 3 commits into from

Conversation

digitalresistor
Copy link
Member

As noted in this comment: #239 (comment)

This adds a new best_client_match function that allows the client to define the order in which things are returned. This does the opposite of best_match which currently considers the server's offers in order, and as long as the client will accept it, it sends the servers preferred answer.

This flips the logic from best_match on it's head, in that it allows the
client to dictate what should be returned given a multitude of server
offerings.

With an accept header of:

application/json, text/html, */*;q=0.8

And a server offer of:

text/html, application/json

The best match returned will be 'application/json'. This makes a lot of
sense in other contexts too, for instance if the browser had a specific
ordering it wanted images in:

image/webp, image/jpeg, image/gif, image/*;q=0.9

If the server offered up image/gif, image/jpeg with best_match this
would return image/gif, with best_client_match, this would return
image/jpeg.
@digitalresistor digitalresistor deleted the feature/Accept.best_client_match branch June 1, 2017 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant