good morning!!!!

Skip to content
Snippets Groups Projects
Commit 86e98b36 authored by Mura Li's avatar Mura Li
Browse files

Less strict about message type of JSON payloads

parent c6e32e19
No related branches found
No related tags found
No related merge requests found
......@@ -20,16 +20,11 @@ func Read(ctx context.Context, c *websocket.Conn, v interface{}) error {
func read(ctx context.Context, c *websocket.Conn, v interface{}) (err error) {
defer errd.Wrap(&err, "failed to read JSON message")
typ, r, err := c.Reader(ctx)
_, r, err := c.Reader(ctx)
if err != nil {
return err
}
if typ != websocket.MessageText {
c.Close(websocket.StatusUnsupportedData, "expected text message")
return fmt.Errorf("expected text message for JSON but got: %v", typ)
}
b := bpool.Get()
defer bpool.Put(b)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment