use spin_sdk::http::{conversions::IntoHeaders, IncomingRequest, Method, Scheme};
#[derive(Debug, Clone)]
pub struct RequestParts {
method: Method,
scheme: Option<Scheme>,
headers: Vec<(String, Vec<u8>)>,
}
impl RequestParts {
pub fn new_from_req(req: &IncomingRequest) -> Self {
Self {
method: req.method(),
scheme: req.scheme(),
headers: req.headers().into_headers(),
}
}
pub fn headers(&self) -> &Vec<(String, Vec<u8>)> {
&self.headers
}
pub fn method(&self) -> &Method {
&self.method
}
pub fn scheme(&self) -> &Option<Scheme> {
&self.scheme
}
}