[PR #10396] fix superfluous call to WriteHeader #13230

Closed
opened 2026-04-13 00:21:32 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/ollama/ollama/pull/10396

State: closed
Merged: Yes


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)
**Original Pull Request:** https://github.com/ollama/ollama/pull/10396 **State:** closed **Merged:** Yes --- 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) ```
GiteaMirror added the pull-request label 2026-04-13 00:21:32 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#13230