Skip to content

Commit

Permalink
Replace the Net::HTTP adapter by a separate gem
Browse files Browse the repository at this point in the history
The Net::HTTP adapter is extracted into its own gem. The idea behind this change is to create an ecosystem of different packages that you can use with Faraday, so that Faraday doesn’t have to ship with the packages itself.

For now all the Net::HTTP tests are still in place to verify that everything is working correctly.
  • Loading branch information
JanDintel committed Oct 23, 2020
1 parent 4e9f4b0 commit 937c86b
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 221 deletions.
1 change: 1 addition & 0 deletions faraday.gemspec
Expand Up @@ -20,6 +20,7 @@ Gem::Specification.new do |spec|

spec.add_dependency 'multipart-post', '>= 1.2', '< 3'
spec.add_dependency 'ruby2_keywords'
spec.add_dependency 'faraday-net_http', '~> 0.0.5'

# Includes `examples` and `spec` to allow external adapter gems to run Faraday unit and integration tests
spec.files = Dir['CHANGELOG.md', '{examples,lib,spec}/**/*', 'LICENSE.md', 'Rakefile', 'README.md']
Expand Down
2 changes: 2 additions & 0 deletions lib/faraday.rb
Expand Up @@ -6,6 +6,8 @@
require 'faraday/middleware_registry'
require 'faraday/dependency_loader'

require 'faraday/net_http'

# This is the main namespace for Faraday.
#
# It provides methods to create {Connection} objects, and HTTP-related
Expand Down
1 change: 0 additions & 1 deletion lib/faraday/adapter.rb
Expand Up @@ -11,7 +11,6 @@ class Adapter

register_middleware File.expand_path('adapter', __dir__),
test: [:Test, 'test'],
net_http: [:NetHttp, 'net_http'],
net_http_persistent: [
:NetHttpPersistent,
'net_http_persistent'
Expand Down
219 changes: 0 additions & 219 deletions lib/faraday/adapter/net_http.rb

This file was deleted.

1 change: 1 addition & 0 deletions lib/faraday/adapter/net_http_persistent.rb
Expand Up @@ -5,6 +5,7 @@ class Adapter
# Net::HTTP::Persistent adapter.
class NetHttpPersistent < NetHttp
dependency 'net/http/persistent'
dependency 'net/http/persistent'

private

Expand Down
1 change: 0 additions & 1 deletion lib/faraday/autoload.rb
Expand Up @@ -58,7 +58,6 @@ def all_loaded_constants
class Adapter
extend AutoloadHelper
autoload_all 'faraday/adapter',
NetHttp: 'net_http',
NetHttpPersistent: 'net_http_persistent',
EMSynchrony: 'em_synchrony',
EMHttp: 'em_http',
Expand Down

0 comments on commit 937c86b

Please sign in to comment.