[PR #10704] [CLOSED] Client request hook #39207

Closed
opened 2026-04-22 23:51:17 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/10704
Author: @linkdata
Created: 5/14/2025
Status: Closed

Base: mainHead: client-request-hook


📝 Commits (2)

📊 Changes

2 files changed (+41 additions, -0 deletions)

View changed files

📝 api/client.go (+14 -0)
📝 api/client_test.go (+27 -0)

📄 Description

This adds an optional Hook field to Client, which allows modifying a *http.Request before it is sent.

My usecase for this is to allow using the Open WebUI passthrough Ollama API which requires adding an "Authorization" header. Rather than limiting it to this, I figure there might be more usecases and adding a hook function is as easy as supporting the specific header.


🔄 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/10704 **Author:** [@linkdata](https://github.com/linkdata) **Created:** 5/14/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `client-request-hook` --- ### 📝 Commits (2) - [`dee892a`](https://github.com/ollama/ollama/commit/dee892ab02eed1fe6ecd40cbb7d5eab86cb1bf46) add Client.Hook - [`2308618`](https://github.com/ollama/ollama/commit/230861853e024c2eb62ebd5e1bd8b4178f57a4b3) add test for Client.Hook ### 📊 Changes **2 files changed** (+41 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `api/client.go` (+14 -0) 📝 `api/client_test.go` (+27 -0) </details> ### 📄 Description This adds an optional `Hook` field to `Client`, which allows modifying a `*http.Request` before it is sent. My usecase for this is to allow using the Open WebUI passthrough Ollama API which requires adding an "Authorization" header. Rather than limiting it to this, I figure there might be more usecases and adding a hook function is as easy as supporting the specific header. --- <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-04-22 23:51:17 -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#39207