Make default output JSON.
This commit is contained in:
Родитель
c65c3dc74d
Коммит
4921890577
|
@ -4,7 +4,7 @@ const Hook = `
|
|||
package handlers
|
||||
|
||||
import (
|
||||
// "encoding/json"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
|
@ -22,11 +22,14 @@ func InterruptHandler(errc chan<- error) {
|
|||
}
|
||||
|
||||
func Report(response, request interface{}, method string) {
|
||||
/* Closer to original client output:
|
||||
fmt.Println("Client Requested with:")
|
||||
fmt.Println(request)
|
||||
fmt.Println("Server Responded with:")
|
||||
fmt.Println(response)
|
||||
/*
|
||||
*/
|
||||
|
||||
// Output response in JSON:
|
||||
buf, err := json.MarshalIndent(response, "", " ")
|
||||
if nil != err {
|
||||
fmt.Fprintf(os.Stderr, "Failed to convert response to JSON: %v\n%s\n",
|
||||
|
@ -34,6 +37,5 @@ func Report(response, request interface{}, method string) {
|
|||
} else {
|
||||
fmt.Printf("%s\n", buf)
|
||||
}
|
||||
*/
|
||||
}
|
||||
`
|
||||
|
|
Загрузка…
Ссылка в новой задаче