Skip to content

Commit

Permalink
support for faraday 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
trusche committed Jun 8, 2024
1 parent 11898e9 commit 0702b3b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 27 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## 1.6.3 - 2023-02-25
## 1.7.0 - 2024-06-08

* [#138](https://github.com/trusche/httplog/pull/138) Support for Faraday v2

## 1.6.3 - 2024-02-25

* Dependecy updates
* [#137](https://github.com/trusche/httplog/pull/137) Fix case sensitivity on response headers
Expand Down
32 changes: 9 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,12 @@ GEM
ffi (>= 1.15.0)
eventmachine (1.2.7)
excon (0.109.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday (2.9.0)
faraday-net_http (>= 2.0, < 3.2)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday-net_http (3.1.0)
net-http
ffi (1.16.3)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
Expand Down Expand Up @@ -92,6 +75,8 @@ GEM
multi_xml (0.6.0)
multipart-post (2.4.0)
nenv (0.3.0)
net-http (0.4.1)
uri
netrc (0.11.0)
notiffany (0.1.3)
nenv (~> 0.1)
Expand Down Expand Up @@ -127,7 +112,6 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
ruby2_keywords (0.0.5)
shellany (0.0.1)
simplecov (0.22.0)
docile (~> 1.1)
Expand All @@ -142,14 +126,16 @@ GEM
thor (1.3.0)
typhoeus (1.4.1)
ethon (>= 0.9.0)
uri (0.13.0)

PLATFORMS
ruby

DEPENDENCIES
ethon (~> 0.11)
excon (~> 0.60)
faraday (~> 1.3)
faraday (>= 1.3)
faraday-multipart (>= 1.0)
guard-rspec (~> 4.7)
http (>= 4.0)
httparty (~> 0.16)
Expand Down
3 changes: 2 additions & 1 deletion httplog.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ Gem::Specification.new do |gem|

gem.add_development_dependency 'ethon', ['~> 0.11']
gem.add_development_dependency 'excon', ['~> 0.60']
gem.add_development_dependency 'faraday', ['~> 1.3']
gem.add_development_dependency 'faraday', ['>= 1.3']
gem.add_development_dependency 'faraday-multipart', ['>= 1.0']
gem.add_development_dependency 'guard-rspec', ['~> 4.7']
gem.add_development_dependency 'http', ['>= 4.0']
gem.add_development_dependency 'httparty', ['~> 0.16']
Expand Down
6 changes: 4 additions & 2 deletions spec/adapters/faraday_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

require 'faraday'
require 'faraday/multipart'

class FaradayAdapter < HTTPBaseAdapter
def send_get_request
connection.get do |req|
Expand Down Expand Up @@ -33,7 +35,7 @@ def send_post_form_request
end

def send_multipart_post_request
file_upload = Faraday::UploadIO.new(@params['file'], 'text/plain')
file_upload = Faraday::Multipart::FilePart.new(@params['file'], 'text/plain')

connection.post do |req|
req.url parse_uri.to_s
Expand All @@ -54,7 +56,7 @@ def self.response_string_for(response)

def connection
Faraday.new(url: "#{@protocol}://#{@host}:#{@port}") do |faraday|
faraday.request :multipart
# faraday.request :multipart
faraday.request :url_encoded

faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
Expand Down

0 comments on commit 0702b3b

Please sign in to comment.