Sha256: c517ca25a9a782fa32e081527dd7472631b922029e2e0473eda323316345e2ed
Contents?: true
Size: 575 Bytes
Versions: 4
Compression:
Stored size: 575 Bytes
Contents
require 'faraday' module Wayback module Response class ParseMementoPage < Faraday::Response::Middleware def parse(body, *opts) body end def on_complete(env) if respond_to?(:parse) && ((env[:response_headers] && env[:response_headers]['content-type']) || '').match(/^(text\/html|application\/octet-stream)/i) unless [204, 301, 302, 304].include?(env[:status]) env[:body] = {:id => env[:url].to_s, :html => parse(env[:body])} else nil end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems