Sha256: 9bca9f963f2a60c8694ca525fbd41066aa561f6e8b1def78cc993c9d37a1a4bd

Contents?: true

Size: 633 Bytes

Versions: 1

Compression:

Stored size: 633 Bytes

Contents

# frozen_string_literal: true

require 'faraday'
require 'faraday/follow_redirects'

module Html2rss
  class RequestService
    ##
    # Strategy to use Faraday for the request.
    # @see https://rubygems.org/gems/faraday
    class FaradayStrategy < Strategy
      # return [Response]
      def execute
        request = Faraday.new(url: ctx.url, headers: ctx.headers) do |faraday|
          faraday.use Faraday::FollowRedirects::Middleware
          faraday.adapter Faraday.default_adapter
        end
        response = request.get

        Response.new(body: response.body, headers: response.headers)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
html2rss-0.16.0 lib/html2rss/request_service/faraday_strategy.rb