getAcceptHeader() public method

Get 'Accept' header.
public getAcceptHeader ( ) : Neomerx\JsonApi\Contracts\Http\Headers\AcceptHeaderInterface
return Neomerx\JsonApi\Contracts\Http\Headers\AcceptHeaderInterface
 /**
  * @param HeaderParametersInterface $parameters
  *
  * @return void
  */
 protected function checkAcceptHeader(HeaderParametersInterface $parameters)
 {
     $this->codecMatcher->matchEncoder($parameters->getAcceptHeader());
     // From spec: Servers MUST respond with a 406 Not Acceptable status code
     // if a request's Accept header contains the JSON API media type and all
     // instances of that media type are modified with media type parameters.
     // We return 406 if no match found for encoder (media type with or wo parameters)
     // If no encoders were configured for media types with parameters we return 406 anyway
     if ($this->codecMatcher->getEncoderHeaderMatchedType() === null) {
         throw new E([], E::HTTP_CODE_NOT_ACCEPTABLE);
     }
 }
Esempio n. 2
0
 /**
  * @inheritdoc
  */
 public function checkHeaders(HeaderParametersInterface $parameters)
 {
     $this->checkContentTypeHeader($parameters->getContentTypeHeader());
     $this->checkAcceptHeader($parameters->getAcceptHeader());
 }