Merge pull request #7 from bapirex/master
Use Addressable instead of URI in client.rb
This commit is contained in:
commit
9402d337d7
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue