Browse Source

respond with 200 with additional info instead of 204

backfeed-full-error
Fusl 2 years ago
parent
commit
591252f581
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      main.go

+ 7
- 1
main.go View File

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

var err error
statusCode := http.StatusNoContent
n := 0
for scanner.Scan() {
b := scanner.Bytes()
if len(b) == 0 {
@@ -443,6 +444,7 @@ func (that *GlobalBackfeedManager) Handle(res http.ResponseWriter, req *http.Req
statusCode = http.StatusServiceUnavailable
break
}
n++
}
if err == nil {
err = scanner.Err()
@@ -450,7 +452,11 @@ func (that *GlobalBackfeedManager) Handle(res http.ResponseWriter, req *http.Req
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
}



Loading…
Cancel
Save