MCPcopy Create free account
hub / github.com/gavv/httpexpect / websocketFastHandler

Function websocketFastHandler

e2e/websocket_test.go:60–82  ·  view source on GitHub ↗
(ctx *fasthttp.RequestCtx)

Source from the content-addressed store, hash-verified

58}
59
60func websocketFastHandler(ctx *fasthttp.RequestCtx) {
61 var upgrader fastwebsocket.FastHTTPUpgrader
62
63 ctx.Response.Header.Set("X-Test", "test_header")
64
65 err := upgrader.Upgrade(ctx, func(c *fastwebsocket.Conn) {
66 defer c.Close()
67
68 for {
69 mt, message, err := c.ReadMessage()
70 if err != nil {
71 break
72 }
73 err = c.WriteMessage(mt, message)
74 if err != nil {
75 break
76 }
77 }
78 })
79 if err != nil {
80 panic(err)
81 }
82}
83
84func testWebsocketConn(e *httpexpect.Expect) {
85 ws := e.GET("/test").WithWebsocketUpgrade().

Callers

nothing calls this directly

Calls 3

CloseMethod · 0.65
ReadMessageMethod · 0.65
WriteMessageMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…