mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-23 15:33:13 +01:00
refactor: remove pocketbase (#1138)
This commit is contained in:
@@ -1,29 +1,46 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/go-chi/chi/v5"
|
||||
)
|
||||
|
||||
type RecordingServer struct {
|
||||
server *echo.Echo
|
||||
server chi.Router
|
||||
|
||||
Entries []string
|
||||
}
|
||||
|
||||
func NewRecordingServer() *RecordingServer {
|
||||
e := echo.New()
|
||||
e := chi.NewRouter()
|
||||
|
||||
e.GET("/health", func(c echo.Context) error {
|
||||
return c.JSON(http.StatusOK, map[string]any{
|
||||
e.Get("/health", func(w http.ResponseWriter, _ *http.Request) {
|
||||
b, err := json.Marshal(map[string]any{
|
||||
"status": "ok",
|
||||
})
|
||||
if err != nil {
|
||||
http.Error(w, "failed to marshal response", http.StatusInternalServerError)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||
_, _ = w.Write(b)
|
||||
})
|
||||
e.Any("/*", func(c echo.Context) error {
|
||||
return c.JSON(http.StatusOK, map[string]any{
|
||||
e.HandleFunc("/*", func(w http.ResponseWriter, _ *http.Request) {
|
||||
b, err := json.Marshal(map[string]any{
|
||||
"test": true,
|
||||
})
|
||||
if err != nil {
|
||||
http.Error(w, "failed to marshal response", http.StatusInternalServerError)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||
_, _ = w.Write(b)
|
||||
})
|
||||
|
||||
return &RecordingServer{
|
||||
|
||||
Reference in New Issue
Block a user