mirror of
https://github.com/dstotijn/hetty.git
synced 2025-07-01 18:47:29 -04:00
Add request and response modifier support
This commit is contained in:
9
main.go
9
main.go
@ -33,6 +33,15 @@ func main() {
|
||||
log.Fatalf("[FATAL] Could not create Proxy: %v", err)
|
||||
}
|
||||
|
||||
proxy.UseRequestModifier(func(req *http.Request) {
|
||||
log.Printf("[DEBUG] Incoming request: %v", req.URL)
|
||||
})
|
||||
|
||||
proxy.UseResponseModifier(func(res *http.Response) error {
|
||||
log.Printf("[DEBUG] Downstream response: %v %v %v", res.Proto, res.StatusCode, http.StatusText(res.StatusCode))
|
||||
return nil
|
||||
})
|
||||
|
||||
s := &http.Server{
|
||||
Addr: ":8080",
|
||||
Handler: proxy,
|
||||
|
Reference in New Issue
Block a user