MCPcopy Create free account
hub / github.com/chromedp/examples / headerServer

Function headerServer

headers/main.go:45–56  ·  view source on GitHub ↗

headerServer is a simple HTTP server that displays the passed headers in the html.

(addr string)

Source from the content-addressed store, hash-verified

43
44// headerServer is a simple HTTP server that displays the passed headers in the html.
45func headerServer(addr string) error {
46 mux := http.NewServeMux()
47 mux.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) {
48 buf, err := json.MarshalIndent(req.Header, "", " ")
49 if err != nil {
50 http.Error(res, err.Error(), http.StatusInternalServerError)
51 return
52 }
53 fmt.Fprintf(res, indexHTML, string(buf))
54 })
55 return http.ListenAndServe(addr, mux)
56}
57
58// setheaders returns a task list that sets the passed headers.
59func setheaders(host string, headers map[string]interface{}, res *string) chromedp.Tasks {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected