use content type application/x-ndjson for streaming responses

This commit is contained in:
Jeffrey Morgan 2023-08-08 21:38:10 -07:00
parent 55cf5021f0
commit cff002b824

View file

@ -367,6 +367,7 @@ func Serve(ln net.Listener, extraOrigins []string) error {
} }
func streamResponse(c *gin.Context, ch chan any) { func streamResponse(c *gin.Context, ch chan any) {
c.Header("Content-Type", "application/x-ndjson")
c.Stream(func(w io.Writer) bool { c.Stream(func(w io.Writer) bool {
val, ok := <-ch val, ok := <-ch
if !ok { if !ok {