validateAcceptHeader() public method

Validates if the current request's Accept header conforms to the JSON API schema.
Example #1
0
 /**
  * @param \WoohooLabs\Yin\JsonApi\Request\RequestInterface $request
  * @throws \Exception
  */
 public function negotiate(RequestInterface $request)
 {
     try {
         $request->validateContentTypeHeader();
         $request->validateAcceptHeader();
     } catch (MediaTypeUnacceptable $e) {
         throw $this->exceptionFactory->createMediaTypeUnacceptableException($request, $e->getMediaTypeName());
     } catch (MediaTypeUnsupported $e) {
         throw $this->exceptionFactory->createMediaTypeUnsupportedException($request, $e->getMediaTypeName());
     }
 }