浏览代码

respond with 200 with additional info instead of 204

backfeed-full-error
Fusl 2 年前
父节点
当前提交
591252f581
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. +7
    -1
      main.go

+ 7
- 1
main.go 查看文件

@@ -427,6 +427,7 @@ func (that *GlobalBackfeedManager) Handle(res http.ResponseWriter, req *http.Req


var err error var err error
statusCode := http.StatusNoContent statusCode := http.StatusNoContent
n := 0
for scanner.Scan() { for scanner.Scan() {
b := scanner.Bytes() b := scanner.Bytes()
if len(b) == 0 { if len(b) == 0 {
@@ -443,6 +444,7 @@ func (that *GlobalBackfeedManager) Handle(res http.ResponseWriter, req *http.Req
statusCode = http.StatusServiceUnavailable statusCode = http.StatusServiceUnavailable
break break
} }
n++
} }
if err == nil { if err == nil {
err = scanner.Err() err = scanner.Err()
@@ -450,7 +452,11 @@ func (that *GlobalBackfeedManager) Handle(res http.ResponseWriter, req *http.Req
statusCode = http.StatusBadRequest statusCode = http.StatusBadRequest
} }
} }
WriteResponse(res, statusCode, err)
if err != nil {
WriteResponse(res, statusCode, err)
} else {
WriteResponse(res, http.StatusOK, fmt.Sprintf("%d items queued", n))
}
return return
} }




正在加载...
取消
保存