extractUri

extractUri

§Signature

§Description

Access the full URI of the request.

Use SchemeDirectives, HostDirectives, PathDirectives, and ParameterDirectives for more targeted access to parts of the URI.

§Example

  1. val route =
  2. extractUri { uri =>
  3. complete(s"Full URI: $uri")
  4. }
  5.  
  6. // tests:
  7. Get("/") ~> route ~> check {
  8. // tests are executed with the host assumed to be "example.com"
  9. responseAs[String] shouldEqual "Full URI: http://example.com/"
  10. }
  11. Get("/test") ~> route ~> check {
  12. responseAs[String] shouldEqual "Full URI: http://example.com/test"
  13. }