grape
grape copied to clipboard
Wrong quality ranking when q parameter is not a float
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.