MCPcopy
hub / github.com/pocketbase/pocketbase / TestEventString

Function TestEventString

tools/router/event_test.go:353–380  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

351}
352
353func TestEventString(t *testing.T) {
354 scenarios := []testResponseWriteScenario[string]{
355 {
356 name: "no explicit content-type",
357 status: 234,
358 headers: nil,
359 body: "test",
360 expectedStatus: 234,
361 expectedHeaders: map[string]string{"content-type": "text/plain; charset=utf-8"},
362 expectedBody: "test",
363 },
364 {
365 name: "with explicit content-type",
366 status: 234,
367 headers: map[string]string{"content-type": "text/test"},
368 body: "test",
369 expectedStatus: 234,
370 expectedHeaders: map[string]string{"content-type": "text/test"},
371 expectedBody: "test",
372 },
373 }
374
375 for _, s := range scenarios {
376 testEventResponseWrite(t, s, func(e *router.Event) error {
377 return e.String(s.status, s.body)
378 })
379 }
380}
381
382func TestEventHTML(t *testing.T) {
383 scenarios := []testResponseWriteScenario[string]{

Callers

nothing calls this directly

Calls 2

testEventResponseWriteFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…