fix HEAD / request

HEAD request should respond like their GET counterparts except without a
response body.
This commit is contained in:
Michael Yang 2023-09-21 16:35:38 -07:00
parent 058d0cd04b
commit c986694367

View file

@ -543,12 +543,11 @@ func Serve(ln net.Listener, allowOrigins []string) error {
},
)
r.GET("/", func(c *gin.Context) {
c.String(http.StatusOK, "Ollama is running")
})
r.HEAD("/", func(c *gin.Context) {
c.Status(http.StatusOK)
})
for _, method := range []string{http.MethodGet, http.MethodHead} {
r.Handle(method, "/", func(c *gin.Context) {
c.String(http.StatusOK, "Ollama is running")
})
}
r.POST("/api/pull", PullModelHandler)
r.POST("/api/generate", GenerateHandler)