use content type application/x-ndjson
for streaming responses
This commit is contained in:
parent
55cf5021f0
commit
cff002b824
1 changed files with 1 additions and 0 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue