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" | |
| ) | |
| func main() { | |
| http.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) { | |
| fmt.Fprint(w, "hello world\n") |
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
| func (srv *Server) Serve(l net.Listener) error { | |
| if fn := testHookServerServe; fn != nil { | |
| fn(srv, l) // call hook with unwrapped listener | |
| } | |
| origListener := l | |
| l = &onceCloseListener{Listener: l} | |
| defer l.Close() | |
| if err := srv.setupHTTP2_Serve(); err != nil { |
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
| // A Handler responds to an HTTP request. | |
| type Handler interface { | |
| ServeHTTP(ResponseWriter, *Request) | |
| } |