(w http.ResponseWriter, r *http.Request)
| 368 | } |
| 369 | |
| 370 | func httpReqHandler(w http.ResponseWriter, r *http.Request) { |
| 371 | //fmt.Println( "HTTP request to ", r.URL.Path ) |
| 372 | //fmt.Println( "Method: ", r.Method ) |
| 373 | |
| 374 | // defer r.Body.Close() // not needed |
| 375 | |
| 376 | body, err := ioutil.ReadAll(r.Body) |
| 377 | if err != nil { |
| 378 | panic("Problem reading HTTP body") |
| 379 | } |
| 380 | |
| 381 | if *doVerbosePtr { |
| 382 | fmt.Println("HTTP Body: ", body) |
| 383 | } |
| 384 | |
| 385 | err = processData(body) |
| 386 | if err != nil { |
| 387 | http.Error(w, err.Error(), 400) |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | func main() { |
| 392 | var err error |
nothing calls this directly
no test coverage detected