Simplify request message parsing

This commit is contained in:
Greg Heartsfield 2021-11-24 14:24:35 -06:00
parent 4e2ec93584
commit 0b7742cfb1

View File

@ -61,10 +61,9 @@ pub fn parse_type(msg: String) -> Result<NostrRequest> {
let typ = msg_type_wrapper(msg)?;
match typ {
NostrRawMessage::Event(_) => Err(Error::EventParseFailed),
NostrRawMessage::Req(m) => {
let s = request::Subscription::parse(&m)?;
Ok(NostrRequest::Subscription(s))
}
NostrRawMessage::Req(m) => Ok(NostrRequest::Subscription(request::Subscription::parse(
&m,
)?)),
NostrRawMessage::Close(_) => Err(Error::CloseParseFailed),
}
}