Fix simple ID serialisation in the WebSocket protocol (#1900)
This commit is contained in:
parent
a31784495f
commit
c3c6613e7a
1 changed files with 3 additions and 15 deletions
|
@ -31,21 +31,9 @@ enum Content<T> {
|
|||
}
|
||||
|
||||
impl<T: Serialize> Response<T> {
|
||||
fn json(self) -> Response<Json> {
|
||||
let Response {
|
||||
id,
|
||||
content,
|
||||
} = self;
|
||||
let content = match content {
|
||||
Content::Success(response) => {
|
||||
Content::Success(Json::from(sql::to_value(response).unwrap()))
|
||||
}
|
||||
Content::Failure(failure) => Content::Failure(failure),
|
||||
};
|
||||
Response {
|
||||
id,
|
||||
content,
|
||||
}
|
||||
#[inline]
|
||||
fn json(self) -> Json {
|
||||
sql::to_value(self).unwrap().into()
|
||||
}
|
||||
|
||||
/// Send the response to the channel
|
||||
|
|
Loading…
Reference in a new issue