fmt=json on websocket

This commit is contained in:
boyska 2018-11-10 17:20:12 +01:00
parent f66e07e873
commit 647701822c

View file

@ -118,10 +118,18 @@ func getWSHandler(hub circolog.Hub) http.HandlerFunc {
WriteBufferSize: 1024,
}
return func(w http.ResponseWriter, r *http.Request) {
render_opts, err := parseRenderParameters(r)
if err != nil {
log.Println("Error parsing:", err)
w.WriteHeader(400)
fmt.Fprintln(w, err)
return
}
opts, err := parseParameters(r)
if err != nil {
log.Println("Error on request parameter \"l\":", err)
w.WriteHeader(400)
fmt.Fprintln(w, err)
return
}
opts.Nofollow = false
@ -156,7 +164,7 @@ func getWSHandler(hub circolog.Hub) http.HandlerFunc {
if err != nil {
return
}
writeFormatted(w, formatSyslog, message)
writeFormatted(w, render_opts.Format, message)
if err := w.Close(); err != nil {
return