lib/pupa/refinements/faraday_middleware.rb in pupa-0.1.11 vs lib/pupa/refinements/faraday_middleware.rb in pupa-0.2.0
- old
+ new
@@ -1,5 +1,7 @@
+require 'openssl'
+
# Caches all requests, not only GET requests.
class FaradayMiddleware::Caching
def call(env)
# Remove if-statement to cache any request, not only GET.
if env[:parallel_manager]
@@ -18,8 +20,8 @@
params = parse_query url.query
params.reject! {|k,| params_to_ignore.include? k }
url.query = params.any? ? build_query(params) : nil
end
url.normalize!
- url.scheme + '://' + url.host + url.request_uri + env[:body].to_s # XXX add for POST requests
+ url.scheme + '://' + url.host + url.request_uri + OpenSSL::Digest::MD5.hexdigest(env[:body].to_s) # XXX add for POST requests
end
end