INNER CODE UNIT · Go
func
zalando/skipper · doc.go:265
func (p *randomPredicate) Match(_ *http.Request) bool {
return rand.Float64() < p.chance
}
In the above example, a custom predicate is created, that can be
referenced in eskip definitions with the name 'Random':
Random(.33) -> "https://test.example.org";
* -> "https://www.example.org"
# Custom Filters
To create a custom filter we need to implement the Spec interface of the
filters package. 'Spec' is the specification of a filter, and it is used
to create concrete filter instances, while the raw route definitions are
processed.
Example, hellofilter.go: