add last-modified header for json profiles
This commit is contained in:
parent
0df49ff670
commit
167c40f550
|
|
@ -41,6 +41,13 @@ class ResponseMacroServiceProvider extends ServiceProvider
|
||||||
});
|
});
|
||||||
|
|
||||||
Response::macro('rawJson', function ($src = "", $status = 200, $header = []) {
|
Response::macro('rawJson', function ($src = "", $status = 200, $header = []) {
|
||||||
|
$last_modified = Arr::get($header, 'Last-Modified', time());
|
||||||
|
|
||||||
|
if (strtotime(Arr::get($_SERVER, 'If-Modified-Since')) >= $last_modified) {
|
||||||
|
$status = 304;
|
||||||
|
$src = "";
|
||||||
|
}
|
||||||
|
|
||||||
return Response::make($src, $status, array_merge([
|
return Response::make($src, $status, array_merge([
|
||||||
'Content-type' => 'application/json',
|
'Content-type' => 'application/json',
|
||||||
'Cache-Control' => 'public, max-age='.option('cache_expire_time') // 365 days
|
'Cache-Control' => 'public, max-age='.option('cache_expire_time') // 365 days
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user