MCPcopy Create free account
hub / github.com/cisco/senml / httpReqHandler

Function httpReqHandler

cmd/senmlServer/senmlServer.go:370–389  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

368}
369
370func 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
391func main() {
392 var err error

Callers

nothing calls this directly

Calls 1

processDataFunction · 0.70

Tested by

no test coverage detected