class PrefersJsonResponses (View source)

Methods

mixed
handle(Request $request, Closure $next)

Handle an incoming request.

bool
acceptHeaderIsBroad(string|null $accept)

Determine if the given "Accept" header value is broad enough to be treated as JSON.

Details

mixed handle(Request $request, Closure $next)

Handle an incoming request.

Parameters

Request $request
Closure $next

Return Value

mixed

protected bool acceptHeaderIsBroad(string|null $accept)

Determine if the given "Accept" header value is broad enough to be treated as JSON.

The header is broad when it's missing or every media-type listed is wildcard ("\/" or "application/*").

Parameters

string|null $accept

Return Value

bool