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

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.