Skip to content

Instantly share code, notes, and snippets.

@s-aska s-aska/capture.go
Created Sep 5, 2017

Embed
What would you like to do?
request capture
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "%s %s HTTP/%d/%d\n", r.Method, r.URL.Path, r.ProtoMajor, r.ProtoMinor)
r.Header.Write(w)
fmt.Fprint(w, "\n")
io.Copy(w, r.Body)
})
http.ListenAndServe(":8080", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.