-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathold.old
41 lines (29 loc) · 800 Bytes
/
old.old
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"fmt"
"net/http"
)
func hello(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "hello\n")
}
func headers(w http.ResponseWriter, req *http.Request) {
for name, headers := range req.Header {
for _, h := range headers {
fmt.Fprintf(w, "%v: %v\n", name, h)
}
}
}
func thiru(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "%v", req.Header)
}
func helloworld(w http.ResponseWriter, req *http.Request) {
fmt.Fprintln(w, "HELLO OCTANK!")
fmt.Fprintln(w, "THIS MEANS IT WORKED")
}
func main() {
http.HandleFunc("/hello", hello)
http.HandleFunc("/headers", headers)
http.HandleFunc("/thiru", thiru)
http.HandleFunc("/helloworld", helloworld)
http.ListenAndServe(":8080", nil)
}