Skip to content

Instantly share code, notes, and snippets.

@ppanyukov
Last active February 8, 2023 15:26
Show Gist options
  • Save ppanyukov/f80dd27290e1633641df7c6e0dd727e6 to your computer and use it in GitHub Desktop.
Save ppanyukov/f80dd27290e1633641df7c6e0dd727e6 to your computer and use it in GitHub Desktop.
Simple web server in golang to dump to echo requests
package main
import (
"fmt"
"net/http"
"net/http/httputil"
)
func handler(w http.ResponseWriter, r *http.Request) {
var formatted, err = httputil.DumpRequest(r, true)
if err != nil {
fmt.Fprint(w, err)
}
w.Write(formatted)
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":80", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment