fmt improvements

otelq
William Perron 1 year ago
parent e99d5309e7
commit 5db0804f1d
No known key found for this signature in database
GPG Key ID: D1815C43C9BA3DE1

@ -20,9 +20,9 @@ var _ http.Handler = &CatHandler{}
func (cs *CatHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { func (cs *CatHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
log.Printf("[%s] %s %s", req.Host, req.Method, req.URL.Path) log.Printf("[%s] %s %s", req.Host, req.Method, req.URL.Path)
w.Write([]byte(fmt.Sprintf("HTTP1.1 %s %s\n", req.Method, req.URL.Path))) w.Write([]byte(fmt.Sprintf("%s %s %s\n", req.Proto, req.Method, req.URL.Path)))
for k, v := range req.Header { for k, v := range req.Header {
w.Write([]byte(fmt.Sprintf("%s: %s\n", k, strings.Join(v, ", ")))) w.Write([]byte(fmt.Sprintf("%s: %s\n", k, strings.Join(v, "; "))))
} }
w.Write([]byte{'\n'}) w.Write([]byte{'\n'})

Loading…
Cancel
Save