1822 Commits

Author SHA1 Message Date
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
sampatbadhe
fecc0a24cb Fix syntax to use correct doc link for url_encoded 2022-07-25 16:47:43 +02:00
Jason Karns
607a725719 Move JsonResponse middleware to response section
The JsonResponse middleware was listed under the Request middleware section for some reason.
2022-07-24 16:11:41 +02:00
水上 皓登
9d4486616a docs link fixed 2022-07-08 17:16:39 +02:00
Konstantin S Kazarin
d420a12a57
Handle verify hostname ssl option (#1428) 2022-06-30 22:26:16 +01:00
Olle Jonsson
fcb2003178
docs: Update to 2022 (#1420) 2022-05-23 14:24:45 +01:00
Matt
71a70f1d8c Remove examples using extension middleware
People want to copy documentation snippets and use them, so they should be compatible with what Faraday offers out-of-the-box.
Fixes #1417
2022-05-17 11:06:50 +02:00
Matt
6ea010be93
Version bump to 2.3.0 v2.3.0 2022-05-06 16:26:46 +01:00
Olle Jonsson
257268e0c8
CI: Update GitHub Action "checkout" to v3 (#1416) 2022-05-06 16:10:46 +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
Thong Kuah
56d58442e5 docs: Correct default default_adapter value
Since https://github.com/lostisland/faraday/pull/1366, the default value for `default_adapter` is `:net_http`.

Fixes https://www.rubydoc.info/gems/faraday/Faraday#default_adapter-class_method
2022-05-03 06:18:24 +02:00
Nicolas Svirchevsky
24eafaa99a
Doc: Added raise_error middleware configuration (#1412) 2022-04-27 15:52:38 +01:00
Matt
24b3fd36e6
Clarifies removal of net_http from v2.0
Adds an explicit not to explain that the `net_http` adapter was originally removed from 2.0 and reintroduced in 2.0.1.
Fixes #1409
2022-03-31 10:35:17 +01:00
Alexander Popov
8f00640dd5 Update custom middleware documentation
Add a section with link to the repo with template.
2022-02-23 21:09:13 +01:00
Joshua Bremer
fc11225474 Add one more require to the quickstart to make this whole thing work immediately 2022-02-18 16:34:22 +01:00
Thomas Sanchez
f003443acc
Add indices when arrays are encoded (#1399) 2022-02-16 10:05:38 +00:00
Olle Jonsson
b2390ec2b3
docs: UPGRADE Note #dependency removed in 2.0 (#1398)
This adds a missing explanation to the UPGRADE document. Anyone searching for `dependency` should be able to find this section.
2022-02-07 10:41:52 +00:00
Olle Jonsson
3fc35dac23
CHANGELOG: add 2.2.0 section (#1394) 2022-02-03 09:50:54 +00:00
Matt
948274e25e
Version bump to 2.2.0 v2.2.0 2022-02-03 09:36:00 +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
Olle Jonsson
33563e3d63 docs: Amend CHANGELOG, link to Releases 2022-02-02 16:07:43 +01:00
Andrew Haines
26d47ca5bb
Remove Faraday 2.0 alpha warning from README (#1385) 2022-01-19 18:59:09 +00: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
José Augusto
9f80f875f7
Update docs to use httpbingo on example requests and add webrick for ruby 3.x support (#1383) 2022-01-18 10:44:16 +00:00
Matt
ae55a744d1
Version bump to 2.1.0 v2.1.0 2022-01-15 14:34:05 +00:00
Yuki Hirasawa
7f004913eb
Add default adapter options (#1382) 2022-01-15 14:32:39 +00:00
Matt
577f0d3e75
Fix test adapter thread safety (#1380) 2022-01-15 08:58:30 +00:00
Matt
996028a165
Introduce mutex Monitor in Faraday::Test::Stubs (#1379)
Fixes #1365
2022-01-12 15:56:25 +00:00
Yuki Hirasawa
026e9569a1
docs: fix regex pattern in logger.md examples (#1378) 2022-01-11 14:26:06 +00:00
Peter Goldstein
295f112356
Add Ruby 3.1 to CI (#1374) 2022-01-07 22:08:29 +00:00
Matt
9825916400
Update instructions for adapters in UPGRADING.md 2022-01-06 09:30:11 +00:00
Matt
309797d573
Version bump to 2.0.1 v2.0.1 2022-01-05 21:49:07 +00:00
Matt
5f88f8ff85
Re-add faraday-net_http as default adapter (#1366) 2022-01-05 21:48:13 +00:00
Olle Jonsson
565f463fdc
docs: Make UPGRADING examples more copyable (#1363) 2022-01-05 08:34:32 +00:00
Mark Huk
50e3ebb805
Updated sample format in UPGRADING.md (#1361) 2022-01-04 19:04:07 +01:00
Matt
0a5714e8c8
Version bump to 2.0.0 v2.0.0 2022-01-04 08:34:19 +00:00
Matt
88d16b7e2d Provide removed middleware with its own section for clarity 2022-01-03 09:40:52 +01:00
Mattia Giuffrida
2d60ce0ac7 Update UPGRADING.md 2022-01-03 09:40:52 +01: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
Matt
1c3e27616d
Improve documentation for v2 (#1353) 2021-12-30 14:46:00 +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
DariuszMusielak
a555580f5f
Allow to raise a Faraday::Error without parameters (#1351) 2021-12-21 09:57:19 +00:00
Jason Banahan
5b8c8a6f2e Include latest jruby openssl version
Fixes issues with letsencrypt certificates
2021-12-17 09:24:12 +01:00
Matt
23e2495636
Update version.rb v2.0.0.alpha-4 2021-12-15 15:22:18 +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 v2.0.0.alpha-3 2021-11-30 10:00:43 +00:00
Matt
64058b983c
Bump version to 2.0.0.alpha-3 2021-11-30 09:39:46 +00:00