mirror of
https://github.com/n30nex/CartoLite-Server.git
synced 2026-10-20 19:31:58 +00:00
* Add live BBS Terminal view * Type terminal paint restoration and cover deployed browser view * Keep Terminal boot assets off other views and include page in images * Isolate Terminal assets and sample map graphics asynchronously * Preserve appearance through Terminal fallback and type sampled pixels * Use public layer ordering and suspend idle Terminal capture * Render Terminal geography on the GPU without pixel readback * Keep label painting separate from map paint settings * Harden glyph state and avoid packet-canvas readback stalls
32 lines
1.1 KiB
Go
32 lines
1.1 KiB
Go
package httpapi
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"strings"
|
|
"testing"
|
|
"testing/fstest"
|
|
)
|
|
|
|
func TestTerminalPageAndCanonicalURL(t *testing.T) {
|
|
server := &Server{static: fstest.MapFS{
|
|
"terminal/index.html": {Data: []byte("<title>CartoLite Terminal</title>")},
|
|
}}
|
|
handler := server.Handler()
|
|
for _, method := range []string{http.MethodGet, http.MethodHead} {
|
|
response := httptest.NewRecorder()
|
|
handler.ServeHTTP(response, httptest.NewRequest(method, "/terminal?node=synthetic", nil))
|
|
if response.Code != http.StatusPermanentRedirect || response.Header().Get("Location") != "/terminal/?node=synthetic" {
|
|
t.Fatalf("Terminal redirect: %d %q", response.Code, response.Header().Get("Location"))
|
|
}
|
|
response = httptest.NewRecorder()
|
|
handler.ServeHTTP(response, httptest.NewRequest(method, "/terminal/", nil))
|
|
if response.Code != http.StatusOK || response.Header().Get("Cache-Control") != "public, no-cache, no-transform" {
|
|
t.Fatalf("Terminal response: %d", response.Code)
|
|
}
|
|
if method == http.MethodGet && !strings.Contains(response.Body.String(), "CartoLite Terminal") {
|
|
t.Fatal("wrong Terminal document")
|
|
}
|
|
}
|
|
}
|