class HandlePrecognitiveRequests

Methods

Response
handle(Request $request, Closure $next)

Handle an incoming request.

void
prepareForPrecognition(Request $request)

Prepare to handle a precognitive request.

Response
appendVaryHeader(Request $request, Response $response)

Append the appropriate "Vary" header to the given response.

Details

at line 16
Response handle(Request $request, Closure $next)

Handle an incoming request.

Parameters

Request $request
Closure $next

Return Value

Response

at line 42
protected void prepareForPrecognition(Request $request)

Prepare to handle a precognitive request.

Sets two request attributes:

  • precognitive: user-facing flag checked by isPrecognitive()
  • precognitive_dispatch: internal flag checked by routing dispatchers to delegate to Precognition variants

Using request attributes instead of container rebinding avoids race conditions in Swoole's concurrent worker model.

Parameters

Request $request

Return Value

void

at line 51
protected Response appendVaryHeader(Request $request, Response $response)

Append the appropriate "Vary" header to the given response.

Parameters

Request $request
Response $response

Return Value

Response