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

Function testWebsocketTypes

e2e/websocket_test.go:140–158  ·  view source on GitHub ↗
(e *httpexpect.Expect)

Source from the content-addressed store, hash-verified

138}
139
140func testWebsocketTypes(e *httpexpect.Expect) {
141 ws := e.GET("/test").WithWebsocketUpgrade().
142 Expect().
143 Status(http.StatusSwitchingProtocols).
144 Websocket()
145 defer ws.Disconnect()
146
147 ws.WriteMessage(websocket.TextMessage, []byte("test")).
148 Expect().
149 Type(websocket.TextMessage).Body().IsEqual("test")
150
151 ws.WriteMessage(websocket.BinaryMessage, []byte("test")).
152 Expect().
153 Type(websocket.BinaryMessage).Body().IsEqual("test")
154
155 ws.WriteMessage(websocket.CloseMessage, []byte("test")).
156 Expect().
157 Type(websocket.CloseMessage).NoContent()
158}
159
160func testWebsocket(e *httpexpect.Expect) {
161 testWebsocketConn(e)

Callers 1

testWebsocketFunction · 0.85

Calls 11

WebsocketMethod · 0.80
StatusMethod · 0.80
WithWebsocketUpgradeMethod · 0.80
GETMethod · 0.80
DisconnectMethod · 0.80
TypeMethod · 0.80
WriteMessageMethod · 0.65
ExpectMethod · 0.45
IsEqualMethod · 0.45
BodyMethod · 0.45
NoContentMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…