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)?; let typ = msg_type_wrapper(msg)?;
match typ { match typ {
NostrRawMessage::Event(_) => Err(Error::EventParseFailed), NostrRawMessage::Event(_) => Err(Error::EventParseFailed),
NostrRawMessage::Req(m) => { NostrRawMessage::Req(m) => Ok(NostrRequest::Subscription(request::Subscription::parse(
let s = request::Subscription::parse(&m)?; &m,
Ok(NostrRequest::Subscription(s)) )?)),
}
NostrRawMessage::Close(_) => Err(Error::CloseParseFailed), NostrRawMessage::Close(_) => Err(Error::CloseParseFailed),
} }
} }