The tprovide
directive is not available in the Java API.
tprovide
Signature
def tprovide[L: Tuple](values: L): Directive[L]
Description
Provides a tuple of values to the inner route.
The tprovide
directive is used as a building block for Custom Directives to provide data to the inner route. To provide just one value use the provide directive. If you want to provide values calculated from the RequestContext
RequestContext
use the textract directive instead.
See Providing Values to Inner Routes for an overview of similar directives.
See also provide for providing a single value.
Example
sourcedef provideStringAndLength(value: String) = tprovide((value, value.length))
val route =
provideStringAndLength("test") { (value, len) =>
complete(s"Value is $value and its length is $len")
}
// tests:
Get("/") ~> route ~> check {
responseAs[String] shouldEqual "Value is test and its length is 4"
}
1.0.1