MCPcopy Index your code
hub / github.com/labstack/echo / TestContext_IsWebSocket

Function TestContext_IsWebSocket

context_test.go:1265–1324  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1263}
1264
1265func TestContext_IsWebSocket(t *testing.T) {
1266 tests := []struct {
1267 c *Context
1268 ws assert.BoolAssertionFunc
1269 }{
1270 {
1271 &Context{
1272 request: &http.Request{
1273 Header: http.Header{
1274 HeaderUpgrade: []string{"websocket"},
1275 HeaderConnection: []string{"upgrade"},
1276 },
1277 },
1278 },
1279 assert.True,
1280 },
1281 {
1282 &Context{
1283 request: &http.Request{
1284 Header: http.Header{
1285 HeaderUpgrade: []string{"Websocket"},
1286 HeaderConnection: []string{"Upgrade"},
1287 },
1288 },
1289 },
1290 assert.True,
1291 },
1292 {
1293 &Context{
1294 request: &http.Request{},
1295 },
1296 assert.False,
1297 },
1298 {
1299 &Context{
1300 request: &http.Request{
1301 Header: http.Header{HeaderUpgrade: []string{"other"}},
1302 },
1303 },
1304 assert.False,
1305 },
1306 {
1307 &Context{
1308 request: &http.Request{
1309 Header: http.Header{
1310 HeaderUpgrade: []string{"websocket"},
1311 HeaderConnection: []string{"close"},
1312 },
1313 },
1314 },
1315 assert.False,
1316 },
1317 }
1318
1319 for i, tt := range tests {
1320 t.Run(fmt.Sprintf("test %d", i+1), func(t *testing.T) {
1321 tt.ws(t, tt.c.IsWebSocket())
1322 })

Callers

nothing calls this directly

Calls 1

IsWebSocketMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…