Skip to content

Commit

Permalink
Passing request options from client to url
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Novak committed Oct 15, 2015
1 parent 26d742c commit 5449271
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/hurley/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def after_callbacks
end

def request(method, path)
Request.new(method, Url.join(@url, path), @header.dup, nil, @request_options.dup, @ssl_options.dup)
Request.new(method, Url.join(@url, path, @request_options.dup), @header.dup, nil, @request_options.dup, @ssl_options.dup)
end

private
Expand Down
11 changes: 6 additions & 5 deletions lib/hurley/url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ def self.escape_paths(*paths)
end.join(SLASH)
end

def self.parse(raw_url)
def self.parse(raw_url, request_options=RequestOptions.new)
case raw_url
when Url then raw_url
when nil, EMPTY then Empty.new
else new(@@parser.call(raw_url.to_s))
else new(@@parser.call(raw_url.to_s), request_options)
end
end

def initialize(parsed)
def initialize(parsed, request_options=RequestOptions.new)
@query_class = request_options.query_class
@parsed = parsed
if u = @parsed.user
@user = CGI.unescape(u)
Expand All @@ -43,8 +44,8 @@ def initialize(parsed)
@parsed.userinfo = nil
end

def self.join(absolute, relative)
parse(absolute).join(parse(relative))
def self.join(absolute, relative, request_options=RequestOptions.new)
parse(absolute, request_options).join(parse(relative, request_options))
end

extend Forwardable
Expand Down

1 comment on commit 5449271

@afn
Copy link

@afn afn commented on 5449271 Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.