Przeglądaj źródła

加入响应占位函数

yjp 1 rok temu
rodzic
commit
434abcd13f
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6 0
      http_binding/response/response.go

+ 6 - 0
http_binding/response/response.go

@@ -9,6 +9,10 @@ import (
 	"net/http"
 )
 
+func NoResponse(_ *binding_context.Context, _ int, _ any, _ error) {
+	return
+}
+
 func SendMsgResponse(c *binding_context.Context, statusCode int, _ any, err error) {
 	msgResp := formMsgResponse(err)
 	c.JSON(statusCode, msgResp)
@@ -158,6 +162,8 @@ func WriteBytes(c *binding_context.Context, statusCode int, bytes []byte, err er
 		c.AbortWithStatus(statusCode)
 		return
 	}
+
+	c.Writer.Flush()
 }
 
 func SendMapXMLResponseIgnoreError(c *binding_context.Context, statusCode int, data map[string]any, _ error) {