diff --git a/emaild/alfonso.go b/emaild/alfonso.go index 4e6b6c4..a105b9f 100644 --- a/emaild/alfonso.go +++ b/emaild/alfonso.go @@ -5,7 +5,7 @@ import "log" import "net/http" import "io/ioutil" -import "github.com/davecgh/go-spew/spew" +// import "github.com/davecgh/go-spew/spew" func handler(w http.ResponseWriter, r *http.Request) { // spew.Dump(r) @@ -27,37 +27,9 @@ func handler2(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE") w.Header().Set("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization") - spew.Dump(r) + // spew.Dump(r) fmt.Fprintf(w, "Hi there, handler2 %s!", r.URL.Path[1:]) - log.Printf("handler: method switch statement") - switch r.Method { - case http.MethodGet: - // Serve the resource. - log.Printf("handler2 GET") - case http.MethodPost: - // Create a new record. - log.Printf("handler2 POST") - case http.MethodPut: - // Update an existing record. - log.Printf("handler2 PUT") - case http.MethodDelete: - // Remove the record. - log.Printf("handler2 DELETE") - case http.MethodOptions: - // Remove the record. - log.Printf("handler2 OPTIONS") - default: - // Give an error message. - log.Printf("handler2 DEFAULT Method=", r.Method) - spew.Dump(r.Method) - } - log.Println("Hi there, handler2 r.URL.Path =", r.URL.Path[1:]) - log.Println("Hi there, handler2 r.URL.Path =", r.URL.Path) - log.Println("Hi there, handler2 r.URL =", r.URL) - log.Println("Hi there, handler2 r =", r) - log.Println("Hi there, handler2 r.Body =", r.Body) - body, err := ioutil.ReadAll(r.Body) j := string(body) log.Println("body =", j)