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
- val route =
- extractUri { uri =>
- complete(s"Full URI: $uri")
- }
-
- // tests:
- Get("/") ~> route ~> check {
- // tests are executed with the host assumed to be "example.com"
- responseAs[String] shouldEqual "Full URI: http://example.com/"
- }
- Get("/test") ~> route ~> check {
- responseAs[String] shouldEqual "Full URI: http://example.com/test"
- }
Contents