-4

How can I find the current URL inside an action/function? I've not found anything related to this in the documentation.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
Xwaro
  • 5

1 Answers1

1

The Iron homepage has this "hello world" example:

fn hello_world(_: &mut Request) -> IronResult<Response> {
    Ok(Response::with((status::Ok, "Hello World!")))
}

The only input to the function is a Request. The very first field on that struct is a Url:

url: Url

The requested URL.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366