Merge pull request #570 from jmorganca/mxyng/head-request

fix HEAD request
This commit is contained in:
Michael Yang 2023-09-21 16:56:17 -07:00 committed by GitHub
commit 2044f9d4da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -543,23 +543,23 @@ 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)
})
r.POST("/api/pull", PullModelHandler)
r.POST("/api/generate", GenerateHandler)
r.POST("/api/embeddings", EmbeddingHandler)
r.POST("/api/create", CreateModelHandler)
r.POST("/api/push", PushModelHandler)
r.POST("/api/copy", CopyModelHandler)
r.GET("/api/tags", ListModelsHandler)
r.DELETE("/api/delete", DeleteModelHandler)
r.POST("/api/show", ShowModelHandler)
for _, method := range []string{http.MethodGet, http.MethodHead} {
r.Handle(method, "/", func(c *gin.Context) {
c.String(http.StatusOK, "Ollama is running")
})
r.Handle(method, "/api/tags", ListModelsHandler)
}
log.Printf("Listening on %s", ln.Addr())
s := &http.Server{
Handler: r,