示例#1
0
 /**
  * Add appropriate response header for response class to output.
  */
 public function resolve(Request $req, Response $res)
 {
     $callback = $req->param('JSONP_CALLBACK_NAME');
     if (!$callback) {
         $callback = $this->defaultCallback;
     }
     if ($callback && $req->param($callback)) {
         $res->header('X-JSONP-CALLBACK', $req->param($callback));
     }
 }
示例#2
0
 /**
  * Checks whether an update is available.
  */
 public function resolve(Request $request, Response $response)
 {
     $path = $request->uri('path');
     $hash = $request->param('v');
     $info = Cache::getInfo($path, $hash);
     if (!$info) {
         return;
     }
     // Send a bunch of headers
     // 1. Conditional request
     // If-Modified-Since: Match against $info->getMTime();
     // If-None-Match: Match against the md5_file();
     // 2. Normal request
     // Content-Type + charset
     // Content-Length
     // Cache-Control
     // Date
     // Pragma (remove)
     // header('Content-Type: application/json; charset=utf-8', true);
 }