Rack uses to_s in the query_string method, meaning nil will be converted to an empty string. However, when checking for the presence of the query string, Rack::Cache uses .nil?. As a result, Rack::Cache currently appends '?' to cache keys, even if the request does not include a query string.
Rack uses
to_s
in thequery_string
method, meaningnil
will be converted to an empty string. However, when checking for the presence of the query string, Rack::Cache uses.nil?
. As a result, Rack::Cache currently appends '?' to cache keys, even if the request does not include a query string.Here is the relevant code in Rack: https://github.com/rack/rack/blob/master/lib/rack/request.rb#L136