lib/zooming-proxy/middleware.rb in zooming-proxy-0.4.0 vs lib/zooming-proxy/middleware.rb in zooming-proxy-0.4.1
- old
+ new
@@ -134,18 +134,18 @@
end
def zoomable?(headers, body, depth)
zoomable = depth <= MAX_DEPTH
zoomable &= headers.include?('x-hal-zoom')
- zoomable &= headers['content-type'].include?('json')
+ zoomable &= headers['content-type'].to_s.include?('json')
zoomable && !body.nil?
end
def requested_links(body, headers)
body['_links']
.to_h
- .select { |k, _| headers['x-hal-zoom'].split(/\s+/).include?(k) }
+ .select { |k, _| headers['x-hal-zoom'].to_s.split(/\s+/).include?(k) }
.each_with_object({}) do |(k, v), urls|
array = v.respond_to?(:to_ary)
[v].flatten.each { |url| urls[url['href']] = { relation: k, array: array } }
end