Skip to content

Commit c8d2d71

Browse files
author
Ruslan Korolev
committedJan 27, 2015
custom uri parser to README + small fixes on Excon.new
1 parent e19dfcd commit c8d2d71

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
 

‎README.md

+4
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ connection = Excon.new('http://geemus.com/', :nonblock => false)
145145
connection = Excon.new('http://username:password@secure.geemus.com')
146146
connection = Excon.new('http://secure.geemus.com',
147147
:user => 'username', :password => 'password')
148+
149+
# use custom uri parser
150+
require 'addressable/uri'
151+
connection = Excon.new('http://geemus.com/', uri_parser: Addressable::URI)
148152
```
149153

150154
## Chunked Requests

‎lib/excon.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def ssl_verify_peer=(new_ssl_verify_peer)
104104
# @param [Hash<Symbol, >] params One or more option params to set on the Connection instance
105105
# @return [Connection] A new Excon::Connection instance
106106
def new(url, params = {})
107-
uri_parser = params[:uri_parser] || Excon.defaults[:uri_parser]
107+
uri_parser = params[:uri_parser] || defaults[:uri_parser]
108108
uri = uri_parser.parse(url)
109109
unless uri.scheme
110110
raise ArgumentError.new("Invalid URI: #{uri}")
@@ -116,7 +116,7 @@ def new(url, params = {})
116116
:port => uri.port,
117117
:query => uri.query,
118118
:scheme => uri.scheme
119-
}.merge!(params)
119+
}.merge(params)
120120
if uri.password
121121
params[:password] = Utils.unescape_uri(uri.password)
122122
end

0 commit comments

Comments
 (0)
Please sign in to comment.