Merge pull request #7 from bapirex/master

Use Addressable instead of URI in client.rb
This commit is contained in:
James Hu 2016-09-30 08:55:34 -07:00 committed by GitHub
commit 9402d337d7
2 changed files with 3 additions and 2 deletions

View File

@ -1 +1 @@
0.5.1 0.5.2

View File

@ -1,5 +1,6 @@
require 'rack' require 'rack'
require 'rack-proxy' require 'rack-proxy'
require 'addressable/uri'
module ReverseProxy module ReverseProxy
class Client class Client
@ -45,7 +46,7 @@ module ReverseProxy
source_request = Rack::Request.new(env) source_request = Rack::Request.new(env)
# We can pass in a custom path # We can pass in a custom path
uri = URI.parse("#{url}#{options[:path] || env['ORIGINAL_FULLPATH']}") uri = Addressable::URI.parse("#{url}#{options[:path] || env['ORIGINAL_FULLPATH']}")
# Initialize request # Initialize request
target_request = Net::HTTP.const_get(source_request.request_method.capitalize).new(uri.request_uri) target_request = Net::HTTP.const_get(source_request.request_method.capitalize).new(uri.request_uri)