Skip to content

Commit

Permalink
Silence CodeQL warning
Browse files Browse the repository at this point in the history
  • Loading branch information
IngmarStein committed May 27, 2024
1 parent 1b293d9 commit dca9b49
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions example/http-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"github.com/davecgh/go-spew/spew"
"html"
"net/http"
"net/http/httputil"
"os"
Expand All @@ -23,16 +24,8 @@ func headers(w http.ResponseWriter, req *http.Request) {
}
spew.Dump(dump)

for name, headers := range req.Header {
for _, h := range headers {

_, err := fmt.Fprintf(w, "%v: %v\n", name, h)
if err != nil {
fmt.Printf("Error writing header %s: %v\n", name, err)
return
}
}
}
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Write([]byte(html.EscapeString(string(dump))))
}

func main() {
Expand Down

0 comments on commit dca9b49

Please sign in to comment.