Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
olleolleolle committed Jan 9, 2024
1 parent 37347c6 commit 69045b6
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions lib/faraday/adapter/net_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,14 @@ def perform_request(http, env)
http_response
end

def request_with_wrapped_block(http, env)
def request_with_wrapped_block(http, env, &block)
# Must use Net::HTTP#start and pass it a block otherwise the server's
# TCP socket does not close correctly.
http.start do |opened_http|
opened_http.request create_request(env) do |response|
save_http_response(env, response)

if block_given?
response.read_body do |chunk|
yield(chunk)
end
end
response.read_body(&block) if block_given?
end
end
end
Expand Down Expand Up @@ -172,20 +168,18 @@ def configure_request(http, req)
def ssl_cert_store(ssl)
return ssl[:cert_store] if ssl[:cert_store]

@ssl_cert_store ||= begin
# Use the default cert store by default, i.e. system ca certs
OpenSSL::X509::Store.new.tap(&:set_default_paths)
end
# Use the default cert store by default, i.e. system ca certs
@ssl_cert_store ||= OpenSSL::X509::Store.new.tap(&:set_default_paths)
end

def ssl_verify_mode(ssl)
ssl[:verify_mode] || begin
if ssl.fetch(:verify, true)
OpenSSL::SSL::VERIFY_PEER
else
OpenSSL::SSL::VERIFY_NONE
end
end
if ssl.fetch(:verify, true)
OpenSSL::SSL::VERIFY_PEER
else
OpenSSL::SSL::VERIFY_NONE
end
end
end

def encoded_body(http_response)
Expand Down

0 comments on commit 69045b6

Please sign in to comment.