lib/zooming-proxy/middleware.rb in zooming-proxy-0.3.0 vs lib/zooming-proxy/middleware.rb in zooming-proxy-0.4.0
- old
+ new
@@ -3,11 +3,16 @@
require 'json'
require 'typhoeus'
Typhoeus::Config.memoize = true
-module ZoomingProxy
+class ZoomingProxy
+ class << self
+ attr_accessor :default_scheme
+ attr_accessor :default_host
+ end
+
# Middleware
#
class Middleware
attr_reader :host, :scheme, :forwarded
@@ -94,11 +99,11 @@
body
end
def request_rel(href, headers)
uri = URI.parse(href)
- uri.scheme = scheme
- uri.host = host
+ uri.scheme = ZoomingProxy.default_scheme || scheme
+ uri.host = ZoomingProxy.default_host || host
Typhoeus::Request.new(uri, headers: headers)
end
def response_to_hash(response)