Pārlūkot izejas kodu

use content type `application/x-ndjson` for streaming responses

Jeffrey Morgan 1 gadu atpakaļ
vecāks
revīzija
cff002b824
1 mainītis faili ar 1 papildinājumiem un 0 dzēšanām
  1. 1 0
      server/routes.go

+ 1 - 0
server/routes.go

@@ -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 {