github.com/kubeshop/testkube@v1.17.23/cmd/debug-server/main.go (about)

     1  package main
     2  
     3  import (
     4  	"flag"
     5  	"fmt"
     6  	"log"
     7  	"net/http"
     8  	"net/http/httputil"
     9  )
    10  
    11  var port = flag.Int("port", 8080, "http port")
    12  
    13  func init() {
    14  	flag.Parse()
    15  }
    16  
    17  func main() {
    18  	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
    19  		dump, err := httputil.DumpRequest(r, true)
    20  		if err != nil {
    21  			fmt.Println(err)
    22  			return
    23  		}
    24  		fmt.Printf("%s\n", dump)
    25  	})
    26  
    27  	fmt.Printf("Listening on :%d port", *port)
    28  	log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", *port), nil))
    29  }