117 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
mi-wada
7926e3aa89
docs: fix usage page to match latest version's default adapter specification (#1447) 2022-09-05 17:11:48 +02:00
Sampat Badhe
1ddf062331
Fix documentation typo (#1441) 2022-08-08 12:26:02 +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
Matt
7f444c3971 Add encoders #sort_params to documentation
Fixes #1429
2022-08-01 09:56:38 +02: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
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
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
Nicolas Svirchevsky
24eafaa99a
Doc: Added raise_error middleware configuration (#1412) 2022-04-27 15:52:38 +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
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
Yuki Hirasawa
026e9569a1
docs: fix regex pattern in logger.md examples (#1378) 2022-01-11 14:26:06 +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
1c3e27616d
Improve documentation for v2 (#1353) 2021-12-30 14:46:00 +00:00
DariuszMusielak
a555580f5f
Allow to raise a Faraday::Error without parameters (#1351) 2021-12-21 09:57:19 +00:00
Matt
fdf797bb28 Add Faraday 1.x examples in authentication.md docs
Fixes #1317
Fixes #1314
2021-09-01 10:57:37 +02:00
Olle Jonsson
7de0a389dc
Say "2021" on the docs website
Using the current year has no legal weight, but it pops.
2021-08-20 17:58:17 +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
7d727f4f02 Merge latest commits from 1.x 2021-08-14 13:32:53 +01:00
Matt
fa612a060a
[1.x] Deprecate Authorization helpers in Faraday::Connection (#1306) 2021-08-14 13:30:11 +01:00
Matt
4b6162d364
Move json middleware (request and response) from faraday_middleware (#1300) 2021-08-09 08:52:02 +01:00
Yutaka Kamei
a1ee375bcd
Add strict_mode to Test::Stubs (#1298) 2021-08-01 17:45:32 +01:00
Adam Doppelt
11d793dd7e
Docs: add more middleware examples (#1277) 2021-05-02 08:28:29 +02:00
Adam Doppelt
a582495311
[docs] Improve introduction page (#1273)
This set of change are intended to help the first-time reader.

- show method signatures for HTTP verbs
- give an overview of adapters & middleware
- explain a bit more about the shortcut methods vs. creating a connection
- use httpbingo.org instead of the defunct sushi.com
- make a quick note about the default connection and url encoding

Discussion started in #1270.
2021-04-26 09:00:28 +02:00
Olle Jonsson
a0c4a1cd03 Trivially edit docs/ README
...to push to the docs/ directory, to try to get it to build.
2021-04-14 08:31:48 +02:00
Damau
8d379a16fe
Some docs on EventMachine adapters. (#1232) 2021-04-11 13:30:57 +01:00
Tiago
118f896ac3
[docs] Add httpx to list of external adapters (#1246)
httpx bundles its own faraday adapter, a la typhoeus. This adds it to the external adapters list.
2021-03-05 12:49:48 +01:00
Nick Campbell
d22dd00856
Fix broken Rubydoc.info links (#1236)
For some reason the docs are not being published for this gem anymore,
but they are still reachable when referencing the github path instead.
2021-01-12 15:19:45 +01:00
Matt
453b26f1f0
Improves retry middleware documentation. (#1228) 2020-12-31 11:25:20 +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
Tijmen Brommet
95667f848a
Update documentation on using the logger (#1196)
`Faraday::Logging::Formatter` is the correct class to subclass.
2020-10-26 09:17:27 +01:00
Olle Jonsson
4e9f4b06f1
Fix a typo re: on_response -> on_complete 2020-10-23 17:28:00 +02:00
Olle Jonsson
0977306827
docs: Fix typo in markdown
Missing backtick ruined some formatting.
2020-10-22 20:23:25 +02:00
Matt
d56742a174
Introduces on_request and on_complete methods in Faraday::Middleware. (#1194) 2020-10-22 15:04:46 +01:00
Olle Jonsson
7326cd8bfd
docs: Adapters, how to create them (#1193)
This begins a new section, probably we want to move the Parallel section to its own "Advanced Adapter authoring" or a subject-specific text. Anyway, we have started!
2020-10-22 11:55:46 +02:00
Joel Stimson
85b46bef6c
Remove retry_change_requests from documentation (#1185) 2020-10-06 10:33:29 +01:00
Matt
9af091f9c4
Improves documentation on how to contribute to the site by using Docker. (#1175) 2020-09-01 16:32:18 +01:00
Alexander Popov
680b9f8a6c Add EditorConfig file
Resolve issues.

More info here: https://editorconfig.org/
2020-04-19 22:56:50 +02:00
Olle Jonsson
3ca146de4d Update year markers to 2020 for a lively look 2020-04-03 18:18:51 +02:00
Marjan Povolni
e2c56e90c9 docs(website): fix request/response mix-up in text 2020-02-24 09:36:13 +01:00
Vincent Voyer
47dcf037a7
Merge branch 'master' into docs/add-documentation-search 2020-01-21 12:38:59 +01:00
Vincent Voyer
008321b24f docs(website): add search to the website
This commit adds documentation search to the whole website using Algolia's
DocSearch project: https://community.algolia.com/docsearch/.
Analytics are available via an Algolia account, ask vincent@codeagain.com for
more information.

I tried to be as close as the Faraday design as possible.
2020-01-21 12:38:12 +01:00
Olle Jonsson
6015ae97d6
[docs] Use "including" wording
By mentioning "including" instead of "configuring like this", we avoid the possible understanding "replace the whole list".
2020-01-09 10:37:22 +01:00
Vincent Voyer
024bfebd1a
docs(retry): precise usage of retry-after
fixes https://github.com/lostisland/faraday/pull/1109#issuecomment-572448991
2020-01-09 09:48:13 +01:00