You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys. I saw that already there are two issue with such behavior. However, they have not solution. I had some problem with crate mount and crate route.
Simple example
extern crate iron;
extern crate router;
extern crate mount;
use iron::{Iron, Request, Response, IronResult};
use iron::status;
use router::{Router};
fn main() {
let mut router = Router::new();
router.get("/get", query_handler, "query_handler");
fn handler(_: &mut Request) -> IronResult<Response> {
Ok(Response::with((status::Ok, "OK")))
}
fn query_handler(_: &mut Request) -> IronResult<Response> {
Ok(Response::with((status::Ok, "query")))
}
let mut mount = mount::Mount::new();
mount
.mount("/", handler)
.mount("/api", router)
;
Iron::new(mount).http("127.0.0.1:3000").unwrap();
}
The only reasonable solution to move in iron crate this struct
I agree, though I would like to have a "original request" field on the iron::Request struct (outside of the extension typemap, as new struct field) instead. E.g.:
structRequest{
...,parent:Option<Request>}
And mount would insert a copy of the old request there before modifying the URL. This is more flexible (as modified headers are available pre-modification as well) though I'm concerned about unnecessary copies.
Hi guys. I saw that already there are two issue with such behavior. However, they have not solution. I had some problem with crate mount and crate route.
Simple example
When i create request like
GET http://www.example.com/api/get/
i had redirect to http://www.example.com/get . This because the mount crate cuts url in there https://github.com/iron/mount/blob/master/src/mount.rs#L119To use both the crates I had fork this project and add dependency route to mount and add this
To https://github.com/iron/router/blob/master/src/router.rs#L178
Now all work fine. But the decision I do not like.
The only reasonable solution to move in iron crate this struct
And use in mount and route crate
The text was updated successfully, but these errors were encountered: