From abb3953bda8e79e8e77c4e23d2ae17300fc911ea Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 8 Oct 2021 11:30:29 +0200 Subject: [PATCH] Register json request middleware and require files automatically --- lib/faraday/request.rb | 1 + lib/faraday/request/json.rb | 2 ++ lib/faraday/response.rb | 1 + 3 files changed, 4 insertions(+) diff --git a/lib/faraday/request.rb b/lib/faraday/request.rb index 9a97ba79b..d139727b8 100644 --- a/lib/faraday/request.rb +++ b/lib/faraday/request.rb @@ -132,6 +132,7 @@ def to_env(connection) require 'faraday/request/authorization' require 'faraday/request/instrumentation' +require 'faraday/request/json' require 'faraday/request/multipart' require 'faraday/request/retry' require 'faraday/request/url_encoded' diff --git a/lib/faraday/request/json.rb b/lib/faraday/request/json.rb index a17a4dd06..4b0b1c0c4 100644 --- a/lib/faraday/request/json.rb +++ b/lib/faraday/request/json.rb @@ -51,3 +51,5 @@ def request_type(env) end end end + +Faraday::Request.register_middleware(json: Faraday::Request::Json) \ No newline at end of file diff --git a/lib/faraday/response.rb b/lib/faraday/response.rb index 505e4ea43..3dd1bc520 100644 --- a/lib/faraday/response.rb +++ b/lib/faraday/response.rb @@ -85,5 +85,6 @@ def apply_request(request_env) end end +require 'faraday/response/json' require 'faraday/response/logger' require 'faraday/response/raise_error'