mirror of
https://github.com/ollama/ollama.git
synced 2025-05-11 18:36:41 +02:00
Merge e0a8a78066
into ecf14a220f
This commit is contained in:
commit
25a41783c9
2 changed files with 23 additions and 0 deletions
|
@ -1181,6 +1181,8 @@ func (s *Server) GenerateRoutes(rc *ollama.Registry) (http.Handler, error) {
|
|||
r.GET("/", func(c *gin.Context) { c.String(http.StatusOK, "Ollama is running") })
|
||||
r.HEAD("/api/version", func(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"version": version.Version}) })
|
||||
r.GET("/api/version", func(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"version": version.Version}) })
|
||||
r.HEAD("/health", func(c *gin.Context) { c.String(http.StatusOK, http.StatusText(http.StatusOK)) })
|
||||
r.GET("/health", func(c *gin.Context) { c.String(http.StatusOK, http.StatusText(http.StatusOK)) })
|
||||
|
||||
// Local model cache management (new implementation is at end of function)
|
||||
r.POST("/api/pull", s.PullHandler)
|
||||
|
|
|
@ -165,6 +165,27 @@ func TestRoutes(t *testing.T) {
|
|||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Health Handler",
|
||||
Method: http.MethodGet,
|
||||
Path: "/health",
|
||||
Setup: func(t *testing.T, req *http.Request) {
|
||||
},
|
||||
Expected: func(t *testing.T, resp *http.Response) {
|
||||
contentType := resp.Header.Get("Content-Type")
|
||||
if contentType != "text/plain; charset=utf-8" {
|
||||
t.Errorf("expected content type text/plain; charset=utf-8, got %s", contentType)
|
||||
}
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read response body: %v", err)
|
||||
}
|
||||
expectedBody := http.StatusText(http.StatusOK)
|
||||
if string(body) != expectedBody {
|
||||
t.Errorf("expected body %s, got %s", expectedBody, string(body))
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Tags Handler (no tags)",
|
||||
Method: http.MethodGet,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue