faraday 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +1 -1
- data/README.md +3 -4
- data/examples/client_spec.rb +1 -1
- data/lib/faraday/adapter/em_http.rb +3 -2
- data/lib/faraday/adapter/excon.rb +2 -2
- data/lib/faraday/adapter/httpclient.rb +2 -1
- data/lib/faraday/adapter/net_http.rb +18 -8
- data/lib/faraday/adapter/typhoeus.rb +1 -1
- data/lib/faraday/adapter.rb +1 -0
- data/lib/faraday/adapter_registry.rb +3 -1
- data/lib/faraday/autoload.rb +1 -1
- data/lib/faraday/connection.rb +3 -3
- data/lib/faraday/dependency_loader.rb +3 -1
- data/lib/faraday/encoders/flat_params_encoder.rb +9 -2
- data/lib/faraday/encoders/nested_params_encoder.rb +7 -2
- data/lib/faraday/error.rb +8 -0
- data/lib/faraday/options.rb +4 -8
- data/lib/faraday/rack_builder.rb +13 -12
- data/lib/faraday/request/authorization.rb +3 -1
- data/lib/faraday/request/multipart.rb +10 -3
- data/lib/faraday/request/url_encoded.rb +3 -1
- data/lib/faraday/request.rb +20 -10
- data/lib/faraday/response/raise_error.rb +12 -1
- data/lib/faraday/response.rb +4 -1
- data/lib/faraday/utils/headers.rb +2 -2
- data/lib/faraday/utils.rb +11 -3
- data/lib/faraday.rb +2 -2
- data/spec/faraday/adapter/em_http_spec.rb +1 -1
- data/spec/faraday/adapter/em_synchrony_spec.rb +1 -1
- data/spec/faraday/adapter/patron_spec.rb +1 -1
- data/spec/faraday/adapter/test_spec.rb +260 -0
- data/spec/faraday/params_encoders/flat_spec.rb +8 -0
- data/spec/faraday/params_encoders/nested_spec.rb +8 -0
- data/spec/faraday/rack_builder_spec.rb +150 -1
- data/spec/faraday/request/authorization_spec.rb +2 -2
- data/spec/faraday/request/multipart_spec.rb +41 -13
- data/spec/faraday/request/url_encoded_spec.rb +13 -0
- data/spec/faraday/request_spec.rb +16 -5
- data/spec/faraday/response/middleware_spec.rb +16 -0
- data/spec/faraday/response/raise_error_spec.rb +33 -0
- data/spec/support/shared_examples/request_method.rb +3 -3
- metadata +21 -6
- data/UPGRADING.md +0 -55
data/UPGRADING.md
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
## Faraday 1.0
|
2
|
-
|
3
|
-
### Errors
|
4
|
-
* Removes sub-class constants definition from `Faraday::Error`. A sub-class (e.g. `ClientError`) was previously accessible
|
5
|
-
either through the `Faraday` module (e.g. `Faraday::ClientError`) or through the `Faraday::Error` class (e.g. `Faraday::Error::ClientError`).
|
6
|
-
The latter is no longer available and the former should be used instead, so check your `rescue`s.
|
7
|
-
* Introduces a new `Faraday::ServerError` (5xx status codes) alongside the existing `Faraday::ClientError` (4xx status codes).
|
8
|
-
Please note `Faraday::ClientError` was previously used for both.
|
9
|
-
* Introduces new Errors that describe the most common REST status codes:
|
10
|
-
* Faraday::BadRequestError (400)
|
11
|
-
* Faraday::UnauthorizedError (401)
|
12
|
-
* Faraday::ForbiddenError (403)
|
13
|
-
* Faraday::ProxyAuthError (407). Please note this raised a `Faraday::ConnectionFailed` before.
|
14
|
-
* Faraday::ConflictError (409)
|
15
|
-
* Faraday::UnprocessableEntityError (422)
|
16
|
-
* The following error classes have changed the hierarchy to better mirror their real-world usage and semantic meaning:
|
17
|
-
* TimeoutError < ServerError (was < ClientError)
|
18
|
-
* ConnectionFailed < Error (was < ClientError)
|
19
|
-
* SSLError < Error (was < ClientError)
|
20
|
-
* ParsingError < Error (was < ClientError)
|
21
|
-
* RetriableResponse < Error (was < ClientError)
|
22
|
-
|
23
|
-
### Custom adapters
|
24
|
-
If you have written a custom adapter, please be aware that `env.body` is now an alias to the two new properties `request_body` and `response_body`.
|
25
|
-
This should work without you noticing if your adapter inherits from `Faraday::Adapter` and calls `save_response`, but if it doesn't, then please ensure you set the `status` BEFORE the `body` while processing the response.
|
26
|
-
|
27
|
-
### Others
|
28
|
-
* Dropped support for jruby and Rubinius.
|
29
|
-
* Officially supports Ruby 2.4+
|
30
|
-
* In order to specify the adapter you now MUST use the `#adapter` method on the connection builder. If you don't do so and your adapter inherits from `Faraday::Adapter` then Faraday will raise an exception. Otherwise, Faraday will automatically push the default adapter at the end of the stack causing your request to be executed twice.
|
31
|
-
```ruby
|
32
|
-
class OfficialAdapter < Faraday::Adapter
|
33
|
-
...
|
34
|
-
end
|
35
|
-
|
36
|
-
class MyAdapter
|
37
|
-
...
|
38
|
-
end
|
39
|
-
|
40
|
-
# This will raise an exception
|
41
|
-
conn = Faraday.new(...) do |f|
|
42
|
-
f.use OfficialAdapter
|
43
|
-
end
|
44
|
-
|
45
|
-
# This will cause Faraday inserting the default adapter at the end of the stack
|
46
|
-
conn = Faraday.new(...) do |f|
|
47
|
-
f.use MyAdapter
|
48
|
-
end
|
49
|
-
|
50
|
-
# You MUST use `adapter` method
|
51
|
-
conn = Faraday.new(...) do |f|
|
52
|
-
f.adapter AnyAdapter
|
53
|
-
end
|
54
|
-
```
|
55
|
-
|