setApiVersion() public method

public setApiVersion ( integer | string $version )
$version integer | string
Beispiel #1
0
 /**
  * @param BaseRequest $request
  * @param int $type
  * @param bool $catch
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function handle(BaseRequest $request, $type = self::MASTER_REQUEST, $catch = true)
 {
     $request = new Request($request);
     $mimeProcResult = $this->processMime((new FormatNegotiator())->getBest($request->headers->get('Accept', '*/*'))->getValue());
     $request->setApiVersion(str_pad($mimeProcResult->apiVersion, 3, '.0'));
     return $this->app->handle($request, $type, $catch);
 }
Beispiel #2
0
 public function testSetApiVersion()
 {
     $request = new Request(new BaseRequest());
     $request->setApiVersion('2.7');
     $this->assertEquals('/2.7/', $request->getPathInfo());
 }