Method: Protocol::HTTP::AcceptEncoding#call
- Defined in:
- lib/protocol/http/accept_encoding.rb
#call(request) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/protocol/http/accept_encoding.rb', line 45 def call(request) request.headers[ACCEPT_ENCODING] = @accept_encoding response = super if body = response.body and !body.empty? and content_encoding = response.headers.delete(CONTENT_ENCODING) # We want to unwrap all encodings content_encoding.reverse_each do |name| if wrapper = @wrappers[name] body = wrapper.call(body) end end response.body = body end return response end |