httplog 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +14 -0
- data/CHANGELOG.md +75 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +124 -0
- data/Guardfile +24 -0
- data/README.md +5 -6
- data/gemfiles/http2.gemfile +5 -0
- data/gemfiles/http3.gemfile +5 -0
- data/gemfiles/http4.gemfile +5 -0
- data/httplog.gemspec +41 -0
- data/lib/httplog/adapters/http.rb +9 -1
- data/lib/httplog/version.rb +1 -1
- data/spec/adapters/ethon_adapter.rb +24 -0
- data/spec/adapters/excon_adapter.rb +14 -0
- data/spec/adapters/faraday_adapter.rb +53 -0
- data/spec/adapters/http_adapter.rb +25 -0
- data/spec/adapters/http_base_adapter.rb +31 -0
- data/spec/adapters/httparty_adapter.rb +14 -0
- data/spec/adapters/httpclient_adapter.rb +25 -0
- data/spec/adapters/net_http_adapter.rb +19 -0
- data/spec/adapters/open_uri_adapter.rb +17 -0
- data/spec/adapters/patron_adapter.rb +34 -0
- data/spec/adapters/typhoeus_adapter.rb +27 -0
- data/spec/configuration_spec.rb +23 -0
- data/spec/http_log_spec.rb +358 -0
- data/spec/log/.gitkeep +0 -0
- data/spec/spec_helper.rb +45 -0
- data/spec/support/index.html +8 -0
- data/spec/support/index.html.gz +0 -0
- data/spec/support/log4r.yml +17 -0
- data/spec/support/test.bin +0 -0
- data/spec/support/test_server.rb +31 -0
- data/spec/support/utf8-invalid.html +0 -0
- data/spec/support/utf8.html +8 -0
- metadata +99 -64
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c303651209c60fe9eee6dbca5268920cfb7fc10c
|
4
|
+
data.tar.gz: f8105724f2519713b68d1646f17cb470864acadd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d44012d40b3694cf0865f8ea398f92603f7cabba87bd839a8e6368d19d394cd59172e951af316f446750c24e980c94302e6b57dba110677fb54195701b6b6605
|
7
|
+
data.tar.gz: 0fefca9e93bf969d81edbd3f0a1dfa54dc52a5818dbf00516f004290f3e50954f099766ad5cc6fa3877d69c1b460d11e9a562653be6d1dcd808a9f6c2832428b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.2
|
data/.travis.yml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- "2.2.8"
|
4
|
+
- "2.3.5"
|
5
|
+
- "2.4.2"
|
6
|
+
gemfile:
|
7
|
+
- gemfiles/http2.gemfile
|
8
|
+
- gemfiles/http3.gemfile
|
9
|
+
- gemfiles/http4.gemfile
|
10
|
+
# uncomment this line if your project needs to run something other than `rake`:
|
11
|
+
script: bundle exec rspec spec
|
12
|
+
# workaround for https://github.com/travis-ci/travis-ci/issues/5239:
|
13
|
+
before_install:
|
14
|
+
- gem install bundler
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
## 1.0.1 - 2018-02-18
|
2
|
+
|
3
|
+
* [#56](https://github.com/trusche/httplog/pull/56) Fixed data logging for httprb v3 ([@tycooon])
|
4
|
+
* Cleaned up dependencies and requiring ruby version >= 2.2
|
5
|
+
|
6
|
+
## 1.0.0 - 2017-11-02
|
7
|
+
|
8
|
+
* [#53](https://github.com/trusche/httplog/pull/53) Fix header logging
|
9
|
+
|
10
|
+
## 0.99.7 - 2017-07-19
|
11
|
+
|
12
|
+
* Requiring `rack` explicitly so that plain ruby clients don't have to
|
13
|
+
|
14
|
+
## 0.99.6 - 2017-07-11
|
15
|
+
|
16
|
+
* Added `enabled` configuration option (default: true, doh)
|
17
|
+
|
18
|
+
## 0.99.5 - 2017-07-05
|
19
|
+
|
20
|
+
* Bugfix: Returning response for patron adapter
|
21
|
+
|
22
|
+
## 0.99.4 - 2017-06-12
|
23
|
+
|
24
|
+
* Bugfix: No longer modifying post data in place for safe logging
|
25
|
+
|
26
|
+
## 0.99.0 - 2017-02-28
|
27
|
+
|
28
|
+
* Proper configuration!
|
29
|
+
|
30
|
+
If you're using any custom configuration, please replace any assignments of the type
|
31
|
+
|
32
|
+
# Old. Bad. Down with this sort of thing.
|
33
|
+
HttpLog.options[:foo] = 'bar'
|
34
|
+
|
35
|
+
with the new configuration block syntax, e.g.
|
36
|
+
|
37
|
+
# Shiny. New. Ruby-ish.
|
38
|
+
HttpLog.configure do |config|
|
39
|
+
config.foo = 'bar'
|
40
|
+
end
|
41
|
+
|
42
|
+
Please see the [README](README.md#configuration) for details. **The old syntax will be dropped in version 1.0.0** (which will be the next version bump) and will raise a deprecation warning until then.
|
43
|
+
|
44
|
+
* Dropped support for typhoeus
|
45
|
+
|
46
|
+
That only means typhoeus is no longer explictly tested; it will probably still work, depending on which adapter is used. With the default ethon adapter, the status code will probably not be logged, and there may be other issues. Typhoeus has its own logging facility, so it's just not worth the headache of trying to stay compatible.
|
47
|
+
|
48
|
+
* Dropped support for log4r.
|
49
|
+
|
50
|
+
Log4r seems to be no longer maintained for some years; it was causing issues with ruby 2.4, so I dropped it.
|
51
|
+
|
52
|
+
* Rounding benchmarks to microseconds. Because anything more is just silly.
|
53
|
+
|
54
|
+
* Support for ruby 2.4
|
55
|
+
* Support for latest versions of all remaining adapters
|
56
|
+
|
57
|
+
## 0.3.3 - 2016-11-28
|
58
|
+
|
59
|
+
* optional prefix for request data
|
60
|
+
|
61
|
+
## 0.3.2 - 2016-04-13
|
62
|
+
|
63
|
+
* support for httpclient 2.7
|
64
|
+
|
65
|
+
## 0.3.1 - 2016-04-06
|
66
|
+
|
67
|
+
* support for latest version of `httprb`
|
68
|
+
|
69
|
+
## 0.3.0 - 2016-01-15
|
70
|
+
* changes
|
71
|
+
* binary data is no longer written to the log
|
72
|
+
* bug fixes
|
73
|
+
* consistently forcing encoding of response body to UTF-8
|
74
|
+
* considering `charset` part of `Content-Type` header when encoding
|
75
|
+
* inspecting 'Content-Encoding' header for gzip decompression in all adapters
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
httplog (1.0.1)
|
5
|
+
colorize (~> 0.8)
|
6
|
+
rack (~> 2.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.5.2)
|
12
|
+
public_suffix (>= 2.0.2, < 4.0)
|
13
|
+
coderay (1.1.2)
|
14
|
+
colorize (0.8.1)
|
15
|
+
daemons (1.2.6)
|
16
|
+
diff-lcs (1.3)
|
17
|
+
docile (1.1.5)
|
18
|
+
domain_name (0.5.20170404)
|
19
|
+
unf (>= 0.0.5, < 1.0.0)
|
20
|
+
ethon (0.11.0)
|
21
|
+
ffi (>= 1.3.0)
|
22
|
+
eventmachine (1.2.5)
|
23
|
+
excon (0.60.0)
|
24
|
+
faraday (0.14.0)
|
25
|
+
multipart-post (>= 1.2, < 3)
|
26
|
+
ffi (1.9.21)
|
27
|
+
formatador (0.2.5)
|
28
|
+
guard (2.14.2)
|
29
|
+
formatador (>= 0.2.4)
|
30
|
+
listen (>= 2.7, < 4.0)
|
31
|
+
lumberjack (>= 1.0.12, < 2.0)
|
32
|
+
nenv (~> 0.1)
|
33
|
+
notiffany (~> 0.0)
|
34
|
+
pry (>= 0.9.12)
|
35
|
+
shellany (~> 0.0)
|
36
|
+
thor (>= 0.18.1)
|
37
|
+
guard-compat (1.2.1)
|
38
|
+
guard-rspec (4.7.3)
|
39
|
+
guard (~> 2.1)
|
40
|
+
guard-compat (~> 1.1)
|
41
|
+
rspec (>= 2.99.0, < 4.0)
|
42
|
+
http (3.0.0)
|
43
|
+
addressable (~> 2.3)
|
44
|
+
http-cookie (~> 1.0)
|
45
|
+
http-form_data (>= 2.0.0.pre.pre2, < 3)
|
46
|
+
http_parser.rb (~> 0.6.0)
|
47
|
+
http-cookie (1.0.3)
|
48
|
+
domain_name (~> 0.5)
|
49
|
+
http-form_data (2.0.0)
|
50
|
+
http_parser.rb (0.6.0)
|
51
|
+
httparty (0.16.0)
|
52
|
+
multi_xml (>= 0.5.2)
|
53
|
+
httpclient (2.8.3)
|
54
|
+
json (2.1.0)
|
55
|
+
listen (3.0.8)
|
56
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
57
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
58
|
+
lumberjack (1.0.12)
|
59
|
+
method_source (0.9.0)
|
60
|
+
multi_xml (0.6.0)
|
61
|
+
multipart-post (2.0.0)
|
62
|
+
nenv (0.3.0)
|
63
|
+
notiffany (0.1.1)
|
64
|
+
nenv (~> 0.1)
|
65
|
+
shellany (~> 0.0)
|
66
|
+
patron (0.12.0)
|
67
|
+
pry (0.11.3)
|
68
|
+
coderay (~> 1.1.0)
|
69
|
+
method_source (~> 0.9.0)
|
70
|
+
public_suffix (3.0.2)
|
71
|
+
rack (2.0.4)
|
72
|
+
rake (12.3.0)
|
73
|
+
rb-fsevent (0.10.2)
|
74
|
+
rb-inotify (0.9.10)
|
75
|
+
ffi (>= 0.5.0, < 2)
|
76
|
+
rspec (3.7.0)
|
77
|
+
rspec-core (~> 3.7.0)
|
78
|
+
rspec-expectations (~> 3.7.0)
|
79
|
+
rspec-mocks (~> 3.7.0)
|
80
|
+
rspec-core (3.7.1)
|
81
|
+
rspec-support (~> 3.7.0)
|
82
|
+
rspec-expectations (3.7.0)
|
83
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
84
|
+
rspec-support (~> 3.7.0)
|
85
|
+
rspec-mocks (3.7.0)
|
86
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
87
|
+
rspec-support (~> 3.7.0)
|
88
|
+
rspec-support (3.7.1)
|
89
|
+
shellany (0.0.1)
|
90
|
+
simplecov (0.15.1)
|
91
|
+
docile (~> 1.1.0)
|
92
|
+
json (>= 1.8, < 3)
|
93
|
+
simplecov-html (~> 0.10.0)
|
94
|
+
simplecov-html (0.10.2)
|
95
|
+
thin (1.7.2)
|
96
|
+
daemons (~> 1.0, >= 1.0.9)
|
97
|
+
eventmachine (~> 1.0, >= 1.0.4)
|
98
|
+
rack (>= 1, < 3)
|
99
|
+
thor (0.20.0)
|
100
|
+
unf (0.1.4)
|
101
|
+
unf_ext
|
102
|
+
unf_ext (0.0.7.5)
|
103
|
+
|
104
|
+
PLATFORMS
|
105
|
+
ruby
|
106
|
+
|
107
|
+
DEPENDENCIES
|
108
|
+
ethon (~> 0.11)
|
109
|
+
excon (~> 0.60)
|
110
|
+
faraday (~> 0.14)
|
111
|
+
guard-rspec (~> 4.7)
|
112
|
+
http (~> 3.0)
|
113
|
+
httparty (~> 0.16)
|
114
|
+
httpclient (~> 2.8)
|
115
|
+
httplog!
|
116
|
+
listen (~> 3.0)
|
117
|
+
patron (~> 0.12)
|
118
|
+
rake (~> 12.3)
|
119
|
+
rspec (~> 3.7)
|
120
|
+
simplecov (~> 0.15)
|
121
|
+
thin (~> 1.7)
|
122
|
+
|
123
|
+
BUNDLED WITH
|
124
|
+
1.16.0
|
data/Guardfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec', :version => 2 do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
+
watch('config/routes.rb') { "spec/routing" }
|
15
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
+
|
17
|
+
# Capybara request specs
|
18
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
19
|
+
|
20
|
+
# Turnip features and steps
|
21
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
22
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
23
|
+
end
|
24
|
+
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
## httplog
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/httplog.
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/httplog.svg)](http://badge.fury.io/rb/httplog) [![Build Status](https://travis-ci.org/trusche/httplog.svg?branch=master)](https://travis-ci.org/trusche/httplog) [![Code Climate](https://codeclimate.com/github/trusche/httplog.svg)](https://codeclimate.com/github/trusche/httplog)
|
4
4
|
|
5
5
|
Log outgoing HTTP requests made from your application. Helps with debugging pesky API error responses, or just generally understanding what's going on under the hood.
|
6
6
|
|
@@ -166,11 +166,9 @@ This will launch a simple rack server on port 9292 and run all tests locally aga
|
|
166
166
|
|
167
167
|
### Contributing
|
168
168
|
|
169
|
-
If you have any issues with httplog,
|
170
|
-
|
171
|
-
|
172
|
-
or fork the project and send a pull request.
|
173
|
-
Please include passing specs with all pull requests.
|
169
|
+
If you have any issues with or feature requests for httplog,
|
170
|
+
please [open an issue](https://github.com/trusche/httplog/issues) on GitHub
|
171
|
+
or fork the project and send a pull request. **Please include passing specs with all pull requests.**
|
174
172
|
|
175
173
|
### Contributors
|
176
174
|
|
@@ -185,3 +183,4 @@ Thanks to these fine folks for contributing pull requests:
|
|
185
183
|
* [Ryan Souza](https://github.com/ryansouza)
|
186
184
|
* [Ilya Bondarenko](https://github.com/sedx)
|
187
185
|
* [Kostas Zacharakis](https://github.com/kzacharakis)
|
186
|
+
* [Yuri Smirnov](https://github.com/tycooon)
|
data/httplog.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Provide a simple gemspec so you can easily use your
|
2
|
+
# project in your rails apps through git.
|
3
|
+
|
4
|
+
$:.push File.expand_path("../lib", __FILE__)
|
5
|
+
require "httplog/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |gem|
|
8
|
+
gem.name = "httplog"
|
9
|
+
gem.version = HttpLog::VERSION
|
10
|
+
gem.licenses = ["MIT"]
|
11
|
+
gem.summary = %q{Log outgoing HTTP requests.}
|
12
|
+
gem.authors = ["Thilo Rusche"]
|
13
|
+
gem.email = %q{thilorusche@gmail.com}
|
14
|
+
gem.files = Dir["lib/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md", "CHANGELOG.md"]
|
15
|
+
gem.homepage = %q{http://github.com/trusche/httplog}
|
16
|
+
gem.description = %q{Log outgoing HTTP requests made from your application. Helpful for tracking API calls
|
17
|
+
of third party gems that don't provide their own log output.}
|
18
|
+
|
19
|
+
gem.files = `git ls-files`.split("\n")
|
20
|
+
gem.test_files = `git ls-files -- test/*`.split("\n")
|
21
|
+
gem.require_paths = ["lib"]
|
22
|
+
|
23
|
+
gem.required_ruby_version = ">= 2.2"
|
24
|
+
|
25
|
+
gem.add_development_dependency "rspec", ["~> 3.7"]
|
26
|
+
gem.add_development_dependency "guard-rspec", ["~> 4.7"]
|
27
|
+
gem.add_development_dependency "thin", ["~> 1.7"]
|
28
|
+
gem.add_development_dependency "httpclient", ["~> 2.8"]
|
29
|
+
gem.add_development_dependency "httparty", ["~> 0.16"]
|
30
|
+
gem.add_development_dependency "faraday", ["~> 0.14"]
|
31
|
+
gem.add_development_dependency "excon", ["~> 0.60"]
|
32
|
+
gem.add_development_dependency "ethon", ["~> 0.11"]
|
33
|
+
gem.add_development_dependency "patron", ["~> 0.12"]
|
34
|
+
gem.add_development_dependency "http", ["~> 3.0"]
|
35
|
+
gem.add_development_dependency "simplecov", ["~> 0.15"]
|
36
|
+
gem.add_development_dependency "rake", ["~> 12.3"]
|
37
|
+
gem.add_development_dependency "listen", ["~> 3.0"]
|
38
|
+
|
39
|
+
gem.add_dependency "colorize", ["~> 0.8"]
|
40
|
+
gem.add_dependency "rack", ["~> 2.0"]
|
41
|
+
end
|
@@ -14,7 +14,15 @@ if defined?(::HTTP::Client) && defined?(::HTTP::Connection)
|
|
14
14
|
if log_enabled
|
15
15
|
HttpLog.log_request(req.verb, req.uri)
|
16
16
|
HttpLog.log_headers(req.headers.to_h)
|
17
|
-
|
17
|
+
|
18
|
+
if defined?(::HTTP::Request::Body)
|
19
|
+
body = req.body.respond_to?(:source) ? req.body.source : req.body.instance_variable_get(:@body)
|
20
|
+
else
|
21
|
+
body = req.body
|
22
|
+
end
|
23
|
+
|
24
|
+
HttpLog.log_data(body.to_s)
|
25
|
+
body.rewind if body.respond_to?(:rewind)
|
18
26
|
end
|
19
27
|
|
20
28
|
bm = Benchmark.realtime do
|
data/lib/httplog/version.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
require "ethon"
|
2
|
+
class EthonAdapter < HTTPBaseAdapter
|
3
|
+
def send_get_request
|
4
|
+
easy = Ethon::Easy.new
|
5
|
+
easy.http_request(parse_uri.to_s, :get, { headers: @headers })
|
6
|
+
easy.perform
|
7
|
+
end
|
8
|
+
|
9
|
+
def send_head_request
|
10
|
+
easy = Ethon::Easy.new
|
11
|
+
easy.http_request(parse_uri.to_s, :head, { headers: @headers })
|
12
|
+
easy.perform
|
13
|
+
end
|
14
|
+
|
15
|
+
def send_post_request
|
16
|
+
easy = Ethon::Easy.new
|
17
|
+
easy.http_request(parse_uri.to_s, :post, { headers: @headers, body: @data })
|
18
|
+
easy.perform
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.is_libcurl?
|
22
|
+
true
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'excon'
|
2
|
+
class ExconAdapter < HTTPBaseAdapter
|
3
|
+
def send_get_request
|
4
|
+
Excon.get(parse_uri.to_s, headers: @headers )
|
5
|
+
end
|
6
|
+
|
7
|
+
def send_head_request
|
8
|
+
Excon.head(parse_uri.to_s, headers: @headers)
|
9
|
+
end
|
10
|
+
|
11
|
+
def send_post_request
|
12
|
+
Excon.post(parse_uri.to_s, body: @data, headers: @headers)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
class FaradayAdapter < HTTPBaseAdapter
|
3
|
+
def send_get_request
|
4
|
+
connection.get do |req|
|
5
|
+
req.url parse_uri.to_s
|
6
|
+
req.headers = @headers
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def send_head_request
|
11
|
+
connection.head do |req|
|
12
|
+
req.url parse_uri.to_s
|
13
|
+
req.headers = @headers
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def send_post_request
|
18
|
+
connection.post do |req|
|
19
|
+
req.url parse_uri.to_s
|
20
|
+
req.headers = @headers
|
21
|
+
req.body = @data
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def send_post_form_request
|
26
|
+
connection.post do |req|
|
27
|
+
req.url parse_uri.to_s
|
28
|
+
req.headers = @headers
|
29
|
+
req.body = @params
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def send_multipart_post_request
|
34
|
+
file_upload = Faraday::UploadIO.new(@params['file'], 'text/plain')
|
35
|
+
|
36
|
+
connection.post do |req|
|
37
|
+
req.url parse_uri.to_s
|
38
|
+
req.headers = @headers
|
39
|
+
req.body = @params.merge('file' => file_upload)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def connection
|
46
|
+
Faraday.new(url: "#{@protocol}://#{@host}:#{@port}") do |faraday|
|
47
|
+
faraday.request :multipart
|
48
|
+
faraday.request :url_encoded
|
49
|
+
|
50
|
+
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|