Explorar o código

fix HEAD / request

HEAD request should respond like their GET counterparts except without a
response body.
Michael Yang hai 1 ano
pai
achega
c986694367
Modificáronse 1 ficheiros con 5 adicións e 6 borrados
  1. 5 6
      server/routes.go

+ 5 - 6
server/routes.go

@@ -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)