feat(lib): replace types with those from http crate
BREAKING CHANGE: `Method`, `Request`, `Response`, `StatusCode`, `Version`, and `Uri` have been replaced with types from the `http` crate. The `hyper::header` module is gone for now. Removed `Client::get`, since it needed to construct a `Request<B>` with an empty body. Just use `Client::request` instead. Removed `compat` cargo feature, and `compat` related API.
This commit is contained in:
@@ -3,8 +3,8 @@ extern crate hyper;
|
||||
extern crate futures;
|
||||
extern crate pretty_env_logger;
|
||||
|
||||
use hyper::header::{ContentLength, ContentType};
|
||||
use hyper::server::{Http, Response, const_service, service_fn};
|
||||
use hyper::{Body, Response};
|
||||
use hyper::server::{Http, const_service, service_fn};
|
||||
|
||||
static PHRASE: &'static [u8] = b"Hello World!";
|
||||
|
||||
@@ -13,10 +13,7 @@ fn main() {
|
||||
let addr = ([127, 0, 0, 1], 3000).into();
|
||||
|
||||
let new_service = const_service(service_fn(|_| {
|
||||
Ok(Response::<hyper::Body>::new()
|
||||
.with_header(ContentLength(PHRASE.len() as u64))
|
||||
.with_header(ContentType::plaintext())
|
||||
.with_body(PHRASE))
|
||||
Ok(Response::new(Body::from(PHRASE)))
|
||||
}));
|
||||
|
||||
let server = Http::new()
|
||||
|
||||
Reference in New Issue
Block a user