Add a detector for REST requests

This detector is added in the constructor because PHP properties
don't allow anonymous functions to be created in side of them.

This detector can be useful when having for example a redirect on
a posts controller to make sure that the slug for a post is correct
when viewing it. That causes problems with REST requests however
because the REST request will be redirected as well.