Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for new iron version 0.7 with hyper 0.12 #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/get_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extern crate iron;
extern crate urlencoded;

use iron::prelude::*;
use iron::status;
use iron::StatusCode;
use urlencoded::UrlEncodedQuery;

fn log_params(req: &mut Request) -> IronResult<Response> {
Expand All @@ -13,10 +13,10 @@ fn log_params(req: &mut Request) -> IronResult<Response> {
Err(ref e) => println!("{:?}", e)
};

Ok(Response::with((status::Ok, "Hello!")))
Ok(Response::with((StatusCode::OK, "Hello!")))
}

// Test out the server with `curl -i "http://localhost:3000/?name=franklin&name=trevor"`
fn main() {
Iron::new(log_params).http("127.0.0.1:3000").unwrap();
Iron::new(log_params).http("127.0.0.1:3000");
}
6 changes: 3 additions & 3 deletions examples/post_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extern crate iron;
extern crate urlencoded;

use iron::prelude::*;
use iron::status;
use iron::StatusCode;
use urlencoded::UrlEncodedBody;

fn log_post_data(req: &mut Request) -> IronResult<Response> {
Expand All @@ -12,10 +12,10 @@ fn log_post_data(req: &mut Request) -> IronResult<Response> {
Err(ref e) => println!("{:?}", e)
};

Ok(Response::with((status::Ok, "Hello!")))
Ok(Response::with((StatusCode::OK, "Hello!")))
}

// Test with `curl -i -X POST "http://localhost:3000/" --data "fruit=apple&name=iron&fruit=pear"`
fn main() {
Iron::new(log_post_data).http("127.0.0.1:3000").unwrap();
Iron::new(log_post_data).http("127.0.0.1:3000");
}
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl Key for UrlEncodedQuery {
type Value = QueryMap;
}

impl<'a, 'b> plugin::Plugin<Request<'a, 'b>> for UrlEncodedQuery {
impl plugin::Plugin<Request> for UrlEncodedQuery {
type Error = UrlDecodingError;

fn eval(req: &mut Request) -> QueryResult {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

req.url.query() seems to fail or something, at least in my testrun it did not give me any data …

Expand All @@ -89,7 +89,7 @@ impl<'a, 'b> plugin::Plugin<Request<'a, 'b>> for UrlEncodedQuery {
}
}

impl<'a, 'b> plugin::Plugin<Request<'a, 'b>> for UrlEncodedBody {
impl plugin::Plugin<Request> for UrlEncodedBody {
type Error = UrlDecodingError;

fn eval(req: &mut Request) -> QueryResult {
Expand Down