X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=dmaap-mediator-producer%2Fstub%2Fics%2Fics.go;h=87457c2bfe1194f364d5de82b57158cae24edfe2;hb=66d3c321ff4f020814fe99e548740d0b7c7d5a85;hp=0818d5e349c2adc044ed454ea9db8cf3141ee777;hpb=45ba7815fa87c5999c521b06becf2d54f98e693a;p=nonrtric.git diff --git a/dmaap-mediator-producer/stub/ics/ics.go b/dmaap-mediator-producer/stub/ics/ics.go index 0818d5e3..87457c2b 100644 --- a/dmaap-mediator-producer/stub/ics/ics.go +++ b/dmaap-mediator-producer/stub/ics/ics.go @@ -23,6 +23,7 @@ package main import ( "flag" "fmt" + "io/ioutil" "net/http" "github.com/gorilla/mux" @@ -43,7 +44,7 @@ func handleTypeRegistration(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) id, ok := vars["typeId"] if ok { - fmt.Println("Registered type ", id) + fmt.Printf("Registered type %v with schema: %v\n", id, readBody(r)) } } @@ -51,6 +52,14 @@ func handleProducerRegistration(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) id, ok := vars["producerId"] if ok { - fmt.Println("Registered producer ", id) + fmt.Printf("Registered producer %v with data: %v\n", id, readBody(r)) } } + +func readBody(r *http.Request) string { + b, readErr := ioutil.ReadAll(r.Body) + if readErr != nil { + return fmt.Sprintf("Unable to read body due to: %v", readErr) + } + return string(b) +}