Skip to content

Commit

Permalink
Add proxy support
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Martinez authored and Chris Anderson committed Jan 13, 2009
1 parent 6b57357 commit 108ec0a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/couchrest.rb
Expand Up @@ -78,6 +78,11 @@ def parse url
}
end

# set proxy for RestClient to use
def proxy url
RestClient.proxy = url
end

# ensure that a database exists
# creates it if it isn't already there
# returns it after it's been created
Expand Down
10 changes: 10 additions & 0 deletions spec/couchrest/core/couchrest_spec.rb
Expand Up @@ -188,4 +188,14 @@
end
end

describe "using a proxy for RestClient connections" do
it "should set proxy url for RestClient" do
CouchRest.proxy 'http://localhost:8888/'
proxy_uri = URI.parse(RestClient.proxy)
proxy_uri.host.should eql( 'localhost' )
proxy_uri.port.should eql( 8888 )
CouchRest.proxy nil
end
end

end

0 comments on commit 108ec0a

Please sign in to comment.