fix type composoble -> composable

This commit is contained in:
Glenn Griffin 2019-12-10 13:50:46 -08:00
parent 6c7daac551
commit 90f27837b3
3 changed files with 4 additions and 5 deletions

View File

@ -75,7 +75,7 @@
//!
//! ## Request Matchers
//!
//! Defining which request an expecation matches is done in a composoble manner
//! Defining which request an expecation matches is done in a composable manner
//! using a series of traits. The core of which is
//! [Mapper](mappers/trait.Mapper.html). The `Mapper` trait is generic
//! over an input type, has an associated `Out` type, and defines a single method
@ -88,7 +88,7 @@
//! Matcher trait simply provides a `matches` method.
//!
//! A request matcher is any `Matcher` that takes accepts a
//! `hyper::Request<Vec<u8>>` as input.
//! `hyper::Request<hyper::body::Bytes>` as input.
//!
//! With that understanding we can discuss how to easily define a request
//! matcher. There are a variety of pre-defined mappers within the `mappers`

View File

@ -95,7 +95,6 @@ where
async fn _respond(resp: hyper::Response<hyper::Body>) -> hyper::Response<hyper::Body> {
resp
}
// Turn &hyper::Response<Vec<u8>> into a hyper::Response<hyper::Body>
let mut builder = hyper::Response::builder();
builder = builder
.status(self.status().clone())

View File

@ -6,7 +6,7 @@ use std::pin::Pin;
use std::sync::{Arc, Mutex};
// type alias for a request that has read a complete body into memory.
type FullRequest = hyper::Request<Vec<u8>>;
type FullRequest = hyper::Request<hyper::body::Bytes>;
/// The Server
pub struct Server {
@ -44,7 +44,7 @@ impl Server {
// read the full body into memory prior to handing it to mappers.
let (head, body) = req.into_parts();
let full_body = hyper::body::to_bytes(body).await?;
let req = hyper::Request::from_parts(head, full_body.to_vec());
let req = hyper::Request::from_parts(head, full_body);
log::debug!("Received Request: {:?}", req);
let resp = on_req(state, req).await;
log::debug!("Sending Response: {:?}", resp);