refactor(routes):
- keep install-mode root redirect to /install and add tests covering install root redirect and install page serving
- change root backend handler from Any("/") to POST("/") so GET / can consistently serve the SPA after install
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
+1
-1
@@ -22,7 +22,7 @@ import (
|
||||
|
||||
// RegisterRoute 路由注册
|
||||
func RegisterRoute(e *echo.Echo) {
|
||||
e.Any("/", func(c echo.Context) error {
|
||||
e.POST("/", func(c echo.Context) error {
|
||||
return c.String(http.StatusOK, "hello epusdt, https://github.com/GMwalletApp/epusdt")
|
||||
})
|
||||
|
||||
|
||||
@@ -167,6 +167,21 @@ func doFormPost(e *echo.Echo, path string, values url.Values) *httptest.Response
|
||||
return rec
|
||||
}
|
||||
|
||||
func TestRootPostRoute(t *testing.T) {
|
||||
e := setupTestEnv(t)
|
||||
|
||||
req := httptest.NewRequest(http.MethodPost, "/", nil)
|
||||
rec := httptest.NewRecorder()
|
||||
e.ServeHTTP(rec, req)
|
||||
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("expected 200, got %d", rec.Code)
|
||||
}
|
||||
if body := rec.Body.String(); body != "hello epusdt, https://github.com/GMwalletApp/epusdt" {
|
||||
t.Fatalf("unexpected body: %q", body)
|
||||
}
|
||||
}
|
||||
|
||||
// TestCreateOrderGmpayV1Solana tests the gmpay route with solana network.
|
||||
func TestCreateOrderGmpayV1Solana(t *testing.T) {
|
||||
e := setupTestEnv(t)
|
||||
|
||||
Reference in New Issue
Block a user