Last active
February 8, 2023 15:26
-
-
Save ppanyukov/f80dd27290e1633641df7c6e0dd727e6 to your computer and use it in GitHub Desktop.
Simple web server in golang to dump to echo requests
This file contains hidden or 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
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