use bytes::Bytes;
use http_body_util::{BodyExt, Full};
use harrow_core::request::Body;
pub(crate) fn body_from_bytes(bytes: Bytes) -> Body {
Full::new(bytes)
.map_err(|e| -> Box<dyn std::error::Error + Send + Sync> { match e {} })
.boxed()
}
#[derive(Debug, thiserror::Error)]
pub(crate) enum ProtocolError {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("HTTP parse error: {0}")]
Parse(String),
#[error("protocol violation: {0}")]
ProtocolViolation(String),
#[error("connection timeout")]
Timeout,
#[error("body too large")]
BodyTooLarge,
#[error("stream closed")]
StreamClosed,
}