From 2bc53608e9257b6b2d2b492c278af2fb0e4ba3d5 Mon Sep 17 00:00:00 2001 From: Ryan Campbell Date: Mon, 29 Oct 2018 07:26:25 -0600 Subject: [PATCH] add req.Host and req.Method to api handler response (#13) This is useful information to return when (for example) testing a reverse proxy. --- app.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app.go b/app.go index 8332283..d40eb0b 100644 --- a/app.go +++ b/app.go @@ -158,10 +158,16 @@ func api(w http.ResponseWriter, req *http.Request) { Hostname string `json:"hostname,omitempty"` IP []string `json:"ip,omitempty"` Headers http.Header `json:"headers,omitempty"` + URL string `json:"url,omitempty"` + Host string `json:"host,omitempty"` + Method string `json:"method,omitempty"` }{ hostname, []string{}, req.Header, + req.URL.RequestURI(), + req.Host, + req.Method, } ifaces, _ := net.Interfaces()