Skip to content

Instantly share code, notes, and snippets.

@axgle
Created April 23, 2014 03:05
Show Gist options
  • Save axgle/11201577 to your computer and use it in GitHub Desktop.
Save axgle/11201577 to your computer and use it in GitHub Desktop.
package main
import (
"github.com/elazarl/goproxy"
"log"
"net/http"
)
func main() {
proxy := goproxy.NewProxyHttpServer()
proxy.OnRequest().DoFunc(func(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) {
req.Header.Set("user-agent", "GO!")
return req, nil
})
proxy.Verbose = true
log.Fatal(http.ListenAndServe(":8888", proxy))
}
@axgle
Copy link
Author

axgle commented Apr 23, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment