Class: Html2rss::RequestService::FaradayStrategy

Inherits:
Strategy
  • Object
show all
Defined in:
lib/html2rss/request_service/faraday_strategy.rb

Overview

Strategy to use Faraday for the request.

Instance Method Summary collapse

Methods inherited from Strategy

#initialize

Constructor Details

This class inherits a constructor from Html2rss::RequestService::Strategy

Instance Method Details

#executeObject

return [Response]



13
14
15
16
17
18
19
20
21
# File 'lib/html2rss/request_service/faraday_strategy.rb', line 13

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