grape icon indicating copy to clipboard operation
grape copied to clipboard

Wrong quality ranking when q parameter is not a float

Open ericproulx opened this issue 1 year ago • 0 comments

I've noticed that processing application/json;q=invalid,application/xml;q=0.5 would set the Grape::Env::API_FORMAT to xml when it should be json. Unfortunately, the RFC isn't clear when q is not a float. Nonetheless the default value is 1.0 and Rack applies it when q is not a float.

My recommendation would be to follow Rack's implementation an probably use its best_q_match function instead of our own.

ericproulx avatar Jul 21 '24 20:07 ericproulx