Skip to content

Commit

Permalink
Register json request middleware and require files automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
iMacTia committed Oct 8, 2021
1 parent 7a3dcd8 commit abb3953
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/faraday/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 2 additions & 0 deletions lib/faraday/request/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ def request_type(env)
end
end
end

Faraday::Request.register_middleware(json: Faraday::Request::Json)
1 change: 1 addition & 0 deletions lib/faraday/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@ def apply_request(request_env)
end
end

require 'faraday/response/json'
require 'faraday/response/logger'
require 'faraday/response/raise_error'

0 comments on commit abb3953

Please sign in to comment.