public function testValidApiVersionGetApiVersionShouldReturnCorrectVersion()
 {
     $request = new Request();
     $correctVersion = ['api_version' => 'v2'];
     $request->headers->replace($correctVersion);
     $requestParser = new RequestParser($request);
     $this->assertTrue($requestParser->getApiVersion() == Version::Version2);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $apiRequestParser = new RequestParser($request);
     $apiVersion = $apiRequestParser->getApiVersion();
     if ($apiVersion == Version::Version1) {
         // Do something with your amazing api 1 version!
     }
     if ($apiVersion == Version::Version2) {
         // Do something with your amazing api 2 version!
     }
     var_dump($request);
     return $next($request);
 }