fmt=json on websocket
This commit is contained in:
parent
f66e07e873
commit
647701822c
1 changed files with 9 additions and 1 deletions
|
@ -118,10 +118,18 @@ func getWSHandler(hub circolog.Hub) http.HandlerFunc {
|
||||||
WriteBufferSize: 1024,
|
WriteBufferSize: 1024,
|
||||||
}
|
}
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
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)
|
opts, err := parseParameters(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Error on request parameter \"l\":", err)
|
log.Println("Error on request parameter \"l\":", err)
|
||||||
w.WriteHeader(400)
|
w.WriteHeader(400)
|
||||||
|
fmt.Fprintln(w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
opts.Nofollow = false
|
opts.Nofollow = false
|
||||||
|
@ -156,7 +164,7 @@ func getWSHandler(hub circolog.Hub) http.HandlerFunc {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
writeFormatted(w, formatSyslog, message)
|
writeFormatted(w, render_opts.Format, message)
|
||||||
|
|
||||||
if err := w.Close(); err != nil {
|
if err := w.Close(); err != nil {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue