lib/lamby/handler.rb in lamby-2.6.1 vs lib/lamby/handler.rb in lamby-2.6.2
- old
+ new
@@ -50,15 +50,15 @@
set_cookies
@called = true
self
end
- def base64_encodeable?
- @headers && (
- @headers['Content-Transfer-Encoding'] == 'binary' ||
- content_encoding_compressed? ||
- @headers['X-Lamby-Base64'] == '1'
+ def base64_encodeable?(hdrs = @headers)
+ hdrs && (
+ hdrs['Content-Transfer-Encoding'] == 'binary' ||
+ content_encoding_compressed?(hdrs) ||
+ hdrs['X-Lamby-Base64'] == '1'
)
end
def body64
Base64.strict_encode64(body)
@@ -87,11 +87,11 @@
else
@app.call rack.env
end
end
- def content_encoding_compressed?
- content_encoding_header = @headers['Content-Encoding'] || ''
+ def content_encoding_compressed?(hdrs)
+ content_encoding_header = hdrs['Content-Encoding'] || ''
content_encoding_header.split(', ').any? { |h| ['br', 'gzip'].include?(h) }
end
end
end