- Updated Dockerfile to build and embed the SvelteKit Web UI directly into the gateway image, eliminating the need for a separate web service. - Modified .dockerignore to exclude unnecessary directories related to the web service. - Adjusted config.compose.yaml to remove CORS settings for the web service, as the UI now shares the same origin as the API. - Enhanced README.md to reflect the new single-port architecture for accessing both the Web UI and API. - Removed the standalone web Dockerfile and updated related documentation for local development and build processes.
29 lines
629 B
Go
29 lines
629 B
Go
package webui
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
func TestHandler_index(t *testing.T) {
|
|
h := Handler()
|
|
rr := httptest.NewRecorder()
|
|
h.ServeHTTP(rr, httptest.NewRequest(http.MethodGet, "/", nil))
|
|
if rr.Code != http.StatusOK {
|
|
t.Fatalf("GET /: %d", rr.Code)
|
|
}
|
|
if got := rr.Header().Get("Content-Type"); got == "" {
|
|
t.Fatal("missing Content-Type")
|
|
}
|
|
}
|
|
|
|
func TestHandler_spaFallback(t *testing.T) {
|
|
h := Handler()
|
|
rr := httptest.NewRecorder()
|
|
h.ServeHTTP(rr, httptest.NewRequest(http.MethodGet, "/servers/foo", nil))
|
|
if rr.Code != http.StatusOK {
|
|
t.Fatalf("GET /servers/foo: %d", rr.Code)
|
|
}
|
|
}
|