fix: inject part into extension when handing init req (#275)

This commit is contained in:
4t145 2025-06-24 00:52:38 +08:00 • committed by GitHub
commit 6d3190504c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -103,6 +103,15 @@ pub(crate) const fn internal_error_response<E: Display>(
}
}
pub(crate) fn unexpected_message_response(
expect: &str,
) -> Response<UnsyncBoxBody<Bytes, Infallible>> {
Response::builder()
.status(http::StatusCode::UNPROCESSABLE_ENTITY)
.body(Full::new(Bytes::from(format!("Unexpected message, expect {expect}"))).boxed_unsync())
.expect("valid response")
}
pub(crate) async fn expect_json<B>(
body: B,
) -> Result<ClientJsonRpcMessage, Response<UnsyncBoxBody<Bytes, Infallible>>>