From 647701822c43e5ccd478e5f7391cd19cf936399a Mon Sep 17 00:00:00 2001 From: boyska Date: Sat, 10 Nov 2018 17:20:12 +0100 Subject: [PATCH] fmt=json on websocket --- cmd/circologd/http.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/circologd/http.go b/cmd/circologd/http.go index 92a1a29..7962d8d 100644 --- a/cmd/circologd/http.go +++ b/cmd/circologd/http.go @@ -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