Code Review
/
nonrtric.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "NONRTRIC - 3PP dependency version update"
[nonrtric.git]
/
dmaap-mediator-producer
/
stub
/
ics
/
ics.go
diff --git
a/dmaap-mediator-producer/stub/ics/ics.go
b/dmaap-mediator-producer/stub/ics/ics.go
index
0818d5e
..
87457c2
100644
(file)
--- 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"
import (
"flag"
"fmt"
+ "io/ioutil"
"net/http"
"github.com/gorilla/mux"
"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 {
vars := mux.Vars(r)
id, ok := vars["typeId"]
if ok {
- fmt.Print
ln("Registered type ", id
)
+ fmt.Print
f("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 {
vars := mux.Vars(r)
id, ok := vars["producerId"]
if ok {
- fmt.Print
ln("Registered producer ", id
)
+ fmt.Print
f("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)
+}