From adfcc427a9980e226b264e088c2b9a4e88ae87de Mon Sep 17 00:00:00 2001 From: joshua stein Date: Fri, 23 Jun 2017 10:00:20 -0500 Subject: [PATCH] add on_connect callback, passing http object --- README.md | 1 + lib/reverse_proxy/client.rb | 2 ++ 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index 4362c9e..a780abe 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ class WordpressController < ApplicationController # There's also other callbacks: # - on_set_cookies + # - on_connect # - on_response # - on_set_cookies # - on_success diff --git a/lib/reverse_proxy/client.rb b/lib/reverse_proxy/client.rb index aa96137..c6bc70f 100644 --- a/lib/reverse_proxy/client.rb +++ b/lib/reverse_proxy/client.rb @@ -7,6 +7,7 @@ module ReverseProxy @@callback_methods = [ :on_response, :on_set_cookies, + :on_connect, :on_success, :on_redirect, :on_missing, @@ -87,6 +88,7 @@ module ReverseProxy # Make the request Net::HTTP.start(uri.hostname, uri.port, http_options) do |http| + callbacks[:on_connect].call(http) target_response = http.request(target_request) end