-
-
Save sidneyw/e37942e4620ad2cbd8d2c6bcebd20968 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proxy := httputil.NewSingleHostReverseProxy(u) | |
// Configure proxy.Director ... | |
// ModifyResponse runs before forwarding the downstream response back to the client | |
proxy.ModifyResponse = func(res *http.Response) error { | |
responseContent := map[string]interface{}{} | |
err := parseResponse(res, &responseContent) | |
if err != nil { | |
return err | |
} | |
return captureMetrics(responseContent) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment