174 Commits

Author SHA1 Message Date
Joe Swatosh
e1dbdf065e
Forward the env to Request::Authorization#header_from (#1450) 2022-10-03 13:20:07 +01:00
Matt
43d6797770
Enables and fixes all new cops. (#1443) 2022-08-08 15:46:54 +01:00
Mattia Giuffrida
1a5b794b88 Disable new streaming API specific tests 2022-08-08 12:23:09 +01:00
Mattia Giuffrida
6799f5852d Introduce new streaming API (#1439)
* Backwards-compatible
* Allow adapters to provide response info to on_call block
* Provide `stream_response` helper method
2022-08-08 12:23:09 +01:00
Yutaka Kamei
cfbea91a69
Support Proc type for stubbed request body (#1436)
Previously, the Faraday testing adapter compared the request body to the
stubbed body just by calling `#==` if the stubbed body is present.
Sometimes, I want to check the equality between request and stubbed body
in more advanced ways. For example, there is a case that I want to check
only the parts of the body are actually passed to Faraday instance like
this:

```ruby
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
  stub.post('/foo', '{"name:"YK","created_at":"ANY STRING IS OK"}') { [200, {}, ''] }
end
connection.post('/foo', JSON.dump(name: 'YK', created_at: Time.now))
stubs.verify_stubbed_calls
```

In this case, it's difficult to make tests always pass with
`"created_at"` because the value is dynamic. So, I came up with an idea
to pass a proc as a stubbed value and compare bodies, inside the proc:

```ruby
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
  check = -> (request_body) { JSON.parse(request_body).slice('name') == { 'name' => 'YK' } }
  stub.post('/foo', check) { [200, {}, ''] }
end
connection.post('/foo', JSON.dump(name: 'YK', created_at: Time.now))
stubs.verify_stubbed_calls
```

I believe this would be flexible but compatible with the previous behavior.
2022-07-28 10:03:13 +01:00
Konstantin S Kazarin
d420a12a57
Handle verify hostname ssl option (#1428) 2022-06-30 22:26:16 +01:00
Chris AtLee
a2b5f7f3a8
Allow application/x-www-form-url_encoded POST requests to use file objects as the request body (#1415) 2022-05-06 15:49:09 +01:00
Thomas Sanchez
f003443acc
Add indices when arrays are encoded (#1399) 2022-02-16 10:05:38 +00:00
Olle Jonsson
46f3b678f0 Refactor test
This avoids leaking the class definition.
2022-02-02 20:24:49 +01:00
Mattia Giuffrida
85dfdf824c Re-add register middleware w/ Symbol, String, Proc
Reintroduce the possibility to register middleware with symbols, strings or procs.

Fixes #1389
2022-02-02 20:24:49 +01:00
José Augusto
816d824bc1
Removing all sushi.com references and change to httpbingo.org (#1384)
Fixes #1164
2022-01-18 16:43:36 +00:00
Yuki Hirasawa
7f004913eb
Add default adapter options (#1382) 2022-01-15 14:32:39 +00:00
Mattia Giuffrida
cb47eca810 Remove multipart middleware and all its documentation and tests. 2022-01-03 09:40:52 +01:00
Matt
93a693b9ef
* Remove retry middleware and all its documentation and tests. (#1356) 2022-01-02 10:19:15 +00:00
Matt
c9b8490bb7
Remove default Faraday.default_adapter value and add exception message with link to usage documentation. (#1354) 2021-12-30 15:38:49 +00:00
Jonathan Rochkind
b1165eac65
Don't call retry_block if retry won't happen due to max_interval and retry_after (#1350) 2021-12-23 10:30:50 +00:00
Simon Schmid
9ef407a028
Callable authorizers (#1345) 2021-12-15 15:21:05 +00:00
Mattia Giuffrida
65b8d3904f Fix Faraday.default_connection_options deep-merge tests 2021-11-30 10:00:43 +00:00
xkwd
746ab737b5
Replace Hash#merge with Utils#deep_merge for connection options (#1343) 2021-11-30 09:37:13 +00:00
Matt
c010031269
Remove net-http adapter and update docs (#1336) 2021-10-25 11:17:11 +01:00
willianzocolau
ceeaa7476f
Improve request info in exceptions raised by RaiseError Middleware (#1335) 2021-10-16 10:31:49 +02:00
Jonathan Rochkind
1d567df2ee
Retry middleware, exceptions option should handle string exception class name consistently (#1334) 2021-10-12 16:16:52 +02:00
Matt
506e97afe6
Fix passing a URL with embedded basic auth (#1324) 2021-09-13 16:36:26 +01:00
Yutaka Kamei
0f9626c48d Respect the params_encoder in Faraday::Adapter::Test (#1316) 2021-08-30 09:35:26 +01:00
Olle Jonsson
120c56988e Lint: skip Performance/StringInclude
We are after the side-effect of setting something in the last match,
from this "useless" RegExp.
2021-08-17 08:44:04 +02:00
Olle Jonsson
f1f36be663 Lint: Style/PerlBackrefs 2021-08-17 08:44:04 +02:00
Olle Jonsson
babfdeaf04 Lint: Avoid an issue with numeric suffix 2021-08-17 08:44:04 +02:00
Olle Jonsson
c0d97cefa5 Lint: Layout/EmptyLineBetweenDefs 2021-08-17 08:44:04 +02:00
Olle Jonsson
33235f482e Lint: Layout/LineEndStringConcatenationIndentation 2021-08-17 08:44:04 +02:00
Olle Jonsson
b183095c52 Lint: Style/HashConversion 2021-08-17 08:44:04 +02:00
Olle Jonsson
e640be9866 Lint Style/RedundantBegin 2021-08-17 08:44:04 +02:00
Matt
fe600c72ad
Drop deprecated auth helpers from Connection. (#1308)
Merge Authentication middleware.
Add possibility of passing a proc.
Update documentation.
2021-08-15 10:28:49 +02:00
Matt
ce0fdf8bca
Remove deprecated Faraday::UploadIO (#1307) 2021-08-14 09:48:16 +01:00
Olle Jonsson
456191715a
Remove deprecated Faraday::Request#method (#1303) 2021-08-09 15:30:37 +02:00
Matt
4b6162d364
Move json middleware (request and response) from faraday_middleware (#1300) 2021-08-09 08:52:02 +01:00
Matt
08b7d4d3b7
Autoloading, dependency loading and middleware registry cleanup (#1301) 2021-08-09 08:25:02 +01:00
Matt
ca37a9420e Merge branch '1.x' of https://github.com/lostisland/faraday 2021-08-01 18:08:32 +01:00
Yutaka Kamei
a1ee375bcd
Add strict_mode to Test::Stubs (#1298) 2021-08-01 17:45:32 +01:00
Matt
6333b73d13
Begin v2 release (#1297)
* Update UPGRADING.md to highlight adapters being moved out
* Cleanup tests
* Cleanup Gemfile
* Update CI
2021-08-01 17:09:03 +01:00
Pavel Rosický
6ed220cabf
Fix jruby incompatibility after moving out EM adapters (#1294) 2021-07-11 11:02:52 +01:00
Alexey D
4dd36897af
Always dup url_prefix in Connection#build_exclusive_url (#1288) 2021-06-24 16:09:26 +01:00
Adam Doppelt
1f496a7f17
Default proxy scheme to http:// if necessary, fixes #1282 (#1283) 2021-05-22 09:27:06 +01:00
Catalin
53e4baedc7
Add proxy setting when url_prefix is changed (#1276)
* Add proxy setting when url_prefix is changed

Without this setting, setting the url_prefix after
a Faraday::Connection is initialized results in no_proxy
settings ignored when using relative paths.

* Increase Rubocop Metrics/ClassLength
2021-04-28 15:54:08 +02:00
Mike Rogers
14d0dd70c4
Replacing Net::HTTP::Persistent with faraday-net_http_persistent (#1250) 2021-03-26 08:00:05 +00:00
Hiroshi Hatake
850155eb41
Handle IPv6 address String on Faraday::Connection#proxy_from_env (#1252) 2021-03-22 11:30:22 +00:00
yarafan
0ed6480f6e
escape colon in path segment (#1237) 2021-01-18 16:18:21 +00:00
Matt
023cc41335
Improves consistency with Faraday::Error and Faraday::RaiseError (#1229) 2020-12-31 13:07:21 +00:00
Matt
97a3bc2386
Fix #1219 Net::HTTP still uses env proxy (#1221) 2020-12-23 14:00:45 +00:00
Nathan Beyer
01c25e880c
Adjust the retry documentation and spec to align with implementation (#1197) (#1198) 2020-10-27 06:11:38 +01:00
Matt
d56742a174
Introduces on_request and on_complete methods in Faraday::Middleware. (#1194) 2020-10-22 15:04:46 +01:00