Skip to content

Commit

Permalink
Client injection through Chainable#default_client
Browse files Browse the repository at this point in the history
  • Loading branch information
blambeau committed Feb 10, 2012
1 parent d2da387 commit d0a80c6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/http/chainable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def request(verb, uri, options = {})
options[:headers] = default_headers.merge(options[:headers] || {})
options[:callbacks] = event_callbacks

Client.new.request verb, uri, options
default_client.request verb, uri, options
end

# Make a request invoking the given event callbacks
Expand Down Expand Up @@ -87,6 +87,14 @@ def accept(type)
end
end

def default_client
@default_client ||= Client.new
end

def default_client=(default_client)
@default_client = default_client
end

def default_headers
@default_headers ||= {}
end
Expand Down

0 comments on commit d0a80c6

Please sign in to comment.