mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-18 21:22:15 +01:00
Add a /ping endpoint
This endpoint can be used to check the service liveness. It can be used for the kubernetes liveness and readiness probs.
This commit is contained in:
@@ -67,6 +67,7 @@ func setup() *echo.Echo {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
e.GET("/ping", func(c echo.Context) error { return nil })
|
||||||
e.POST("/merge", merge)
|
e.POST("/merge", merge)
|
||||||
g := e.Group("/convert")
|
g := e.Group("/convert")
|
||||||
g.POST("/html", convertHTML)
|
g.POST("/html", convertHTML)
|
||||||
|
|||||||
20
internal/app/api/api_test.go
Normal file
20
internal/app/api/api_test.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"net/http/httptest"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/labstack/echo"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestPing(t *testing.T) {
|
||||||
|
req := httptest.NewRequest(http.MethodGet, "/ping", nil)
|
||||||
|
rec := httptest.NewRecorder()
|
||||||
|
|
||||||
|
e := echo.New()
|
||||||
|
_ = e.NewContext(req, rec)
|
||||||
|
|
||||||
|
assert.Equal(t, http.StatusOK, rec.Code)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user