mirror of
https://github.com/ollama/ollama.git
synced 2025-05-10 18:06:33 +02:00
fix superfluous call to WriteHeader
the first call to http.ResponseWriter.Write implicitly calls WriteHeader with http.StatusOK if it hasn't already been called. once WriteHeader has been called, subsequent calls has no effect. Write is called when JSON encoding progressUpdateJSON{}. calls to http.ResponseWriter.WriteHeader after the first encode is useless and produces a warning: http: superfluous response.WriteHeader call from github.com/ollama/ollama/server/internal/registry.(*statusCodeRecorder).WriteHeader (server.go:77)
This commit is contained in:
parent
4892872c18
commit
214a7678ea
1 changed files with 6 additions and 1 deletions
|
@ -73,8 +73,13 @@ type statusCodeRecorder struct {
|
|||
func (r *statusCodeRecorder) WriteHeader(status int) {
|
||||
if r._status == 0 {
|
||||
r._status = status
|
||||
r.ResponseWriter.WriteHeader(status)
|
||||
}
|
||||
r.ResponseWriter.WriteHeader(status)
|
||||
}
|
||||
|
||||
func (r *statusCodeRecorder) Write(b []byte) (int, error) {
|
||||
r._status = r.status()
|
||||
return r.ResponseWriter.Write(b)
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue