add req.Host and req.Method to api handler response (#13)

This is useful information to return when (for example) testing a
reverse proxy.
This commit is contained in:
Ryan Campbell
2018-10-29 07:26:25 -06:00
committed by Ludovic Fernandez
parent 90c7fab968
commit 2bc53608e9

6
app.go
View File

@ -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()