Add support for calling closures before a ray request, see [spatie/ray PR 859](https://github.com/spatie/ray/pull/859).