MCPcopy Create free account
hub / github.com/pace/bricks / TestMiddlewareWithoutLocale

Function TestMiddlewareWithoutLocale

locale/http_test.go:66–78  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

64}
65
66func TestMiddlewareWithoutLocale(t *testing.T) {
67 r, err := http.NewRequest("GET", "http://example.com/test", nil)
68 require.NoError(t, err)
69
70 rec := new(httpRecorderNext)
71 h := Handler()(rec)
72 h.ServeHTTP(nil, r)
73
74 lctx, ok := FromCtx(rec.r.Context())
75 require.True(t, ok)
76 assert.False(t, lctx.HasLanguage())
77 assert.False(t, lctx.HasTimezone())
78}
79
80func TestMiddlewareWithLocale(t *testing.T) {
81 l := NewLocale("fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5", "Europe/Paris")

Callers

nothing calls this directly

Calls 6

FromCtxFunction · 0.85
ContextMethod · 0.80
HasLanguageMethod · 0.80
HasTimezoneMethod · 0.80
HandlerFunction · 0.70
ServeHTTPMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…