use string.fromBytes to replace cast[string](bytes)

This commit is contained in:
jangko 2021-06-23 19:32:05 +07:00
parent 69e8be66fb
commit b9e9be8f19
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
2 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import
std/[strtabs, tables, uri, strutils],
pkg/[chronos, ws/ws, chronicles],
ws/extensions/compression/deflate,
stew/byteutils,
../client
export client
@ -51,7 +52,7 @@ proc processData(client: RpcWebSocketClient) {.async.} =
# transmission ends
break
client.processMessage(cast[string](value))
client.processMessage(string.fromBytes(value))
except CatchableError as e:
error = e

View File

@ -1,6 +1,7 @@
import
chronicles, httputils, chronos, ws/ws,
ws/extensions/compression/deflate,
stew/byteutils,
".."/[errors, server]
export server
@ -39,7 +40,7 @@ proc handleRequest(rpc: RpcWebSocketServer, request: HttpRequest) {.async.} =
)
break
let future = rpc.route(cast[string](recvData))
let future = rpc.route(string.fromBytes(recvData))
yield future
if future.failed:
debug "Internal error, while processing RPC call",