浏览代码

加入响应占位函数

yjp 1 年之前
父节点
当前提交
434abcd13f
共有 1 个文件被更改,包括 6 次插入0 次删除
  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) {