[PR #10396] [MERGED] fix superfluous call to WriteHeader #75524

Closed
opened 2026-05-05 07:56:48 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/10396
Author: @mxyng
Created: 4/24/2025
Status: ✅ Merged
Merged: 4/25/2025
Merged by: @mxyng

Base: main ← Head: mxyng/fix-superfluous-write-header


📝 Commits (1)

  • 5fc7b50 fix superfluous call to WriteHeader

📊 Changes

1 file changed (+6 additions, -1 deletions)

View changed files

📝 server/internal/registry/server.go (+6 -1)

📄 Description

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 issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/10396 **Author:** [@mxyng](https://github.com/mxyng) **Created:** 4/24/2025 **Status:** ✅ Merged **Merged:** 4/25/2025 **Merged by:** [@mxyng](https://github.com/mxyng) **Base:** `main` ← **Head:** `mxyng/fix-superfluous-write-header` --- ### 📝 Commits (1) - [`5fc7b50`](https://github.com/ollama/ollama/commit/5fc7b50a8cbde0e0058af7c2b32ab343a664657f) fix superfluous call to WriteHeader ### 📊 Changes **1 file changed** (+6 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `server/internal/registry/server.go` (+6 -1) </details> ### 📄 Description 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) ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-05 07:56:48 -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#75524