Search code examples
requestkohanakohana-3internal

How to know if a Kohana request is an internal one?


I'm writing an API using Kohana. Each external request must be signed by the client to be accepted.

However, I also sometime need to do internal requests by building a Request object and calling execute(). In these cases, the signature is unnecessary since I know the request is safe. So I need to know that the request was internal so that I can skip the signature check.

So is there any way to find out if the request was manually created using a Request object?


Solution

  • Can you use the is_initial() method of the request object? Using this method, you can determine if a request is a sub request.

    Kohana 3.2 API, Request - is_initial()