Skip to content

Commit

Permalink
Fix fphilipe#280 cannot pass headers to net http on ruby 2
Browse files Browse the repository at this point in the history
  • Loading branch information
lauratpa committed Jan 5, 2023
1 parent 33287e8 commit fdbb858
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/premailer/rails/css_loaders/network_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ module NetworkLoader

def load(url)
uri = uri_for_url(url)
Net::HTTP.get(uri, { 'Accept' => 'text/css' }) if uri
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0.0")
Net::HTTP.get(uri, { 'Accept' => 'text/css' }) if uri
else
Net::HTTP.get(uri) if uri
end
end

def uri_for_url(url)
Expand Down

0 comments on commit fdbb858

Please sign in to comment.