コード例 #1
0
ファイル: Router.php プロジェクト: jacobDaeHyung/api
 /**
  * Parse a requests accept header.
  *
  * @param \Illuminate\Http\Request $request
  *
  * @return array
  */
 protected function parseAcceptHeader(Request $request)
 {
     if (preg_match('#application/vnd\\.' . $this->properties->getVendor() . '.(v[\\d\\.]+)\\+(\\w+)#', $request->header('accept'), $matches)) {
         return array_slice($matches, 1);
     } elseif ($this->isStrict()) {
         throw new InvalidAcceptHeaderException('Unable to match the "Accept" header for the API request.');
     }
     return [$this->properties->getVersion(), $this->properties->getFormat()];
 }
コード例 #2
0
ファイル: Dispatcher.php プロジェクト: jacobDaeHyung/api
 /**
  * Build the "Accept" header.
  *
  * @return string
  */
 protected function buildAcceptHeader()
 {
     return sprintf('application/vnd.%s.%s+%s', $this->properties->getVendor(), $this->version, $this->properties->getFormat());
 }
コード例 #3
0
ファイル: GroupCollection.php プロジェクト: jacobDaeHyung/api
 /**
  * Get the default API route collection.
  *
  * @return \Dingo\Api\Routing\RouteCollection|null
  */
 public function getDefault()
 {
     return $this->getByVersion($this->properties->getVersion());
 }