Exemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function acceptedMediaType()
 {
     if ($this->mediaTypeAfterVendorIsValid()) {
         return $this->acceptHeaderMediaTypeAfterVendor();
     }
     if ($this->mediaTypeAfterApplicationIsValid()) {
         return $this->acceptHeaderMediaTypeAfterApplication();
     }
     return $this->version->defaultMediaType($this->version());
 }
Exemplo n.º 2
0
 function it_returns_the_default_if_content_type_is_not_specified(Request $request, \LaraPackage\Api\Contracts\Config\ApiVersion $version)
 {
     $this->requestHeaderExpectation($request, '');
     $version->latest()->shouldBeCalledTimes(3)->willReturn(4);
     $version->isValid(4)->shouldBeCalledTimes(3)->willReturn(true);
     $version->mediaTypeIsValid(false, 4)->shouldBeCalledTimes(2)->willReturn(false);
     $version->defaultMediaType(4)->shouldBeCalledTimes(1)->willReturn('json');
     $this->acceptedMediaType()->shouldReturn('json');
 }