title: Laravel showing error which trying to access /api route
body: <p>When trying to access <code>/api</code> route in browser or postman, I'm getting following error. The error trace:</p>
  
  <pre><code>"message": "Accept header could not be properly parsed because of a strict matching process.",
    "status_code": 400,
    "debug": {
      "line": 74,
      "file": "/usr/local/var/www/htdocs/test-core/app/Wordpress/Http/Parser/Accept.php",
      "class": "Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException",
      "trace": Array[11][
        "#0 /usr/local/var/www/htdocs/test-core/app/Wordpress/Http/Validation/Accept.php(55): App\\Wordpress\\Http\\Parser\\Accept-&gt;parse(Object(Illuminate\\Http\\Request), true)",
        "#1 /usr/local/var/www/htdocs/test-core/app/Wordpress/Http/RequestValidator.php(102): App\\Wordpress\\Http\\Validation\\Accept-&gt;validate(Object(Illuminate\\Http\\Request))",
        "#2 /usr/local/var/www/htdocs/test-core/app/Wordpress/Http/Middleware/Request.php(94): App\\Wordpress\\Http\\RequestValidator-&gt;validateRequest(Object(Illuminate\\Http\\Request))",
        "#3 /usr/local/var/www/htdocs/test-core/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\\Wordpress\\Http\\Middleware\\Request-&gt;handle(Object(Illuminate\\Http\\Request), Object(Closure))",
        "#4 /usr/local/var/www/htdocs/test-core/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline-&gt;Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
        "#5 /usr/local/var/www/htdocs/test-core/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline-&gt;Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
        "#6 /usr/local/var/www/htdocs/test-core/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline-&gt;then(Object(Closure))",
        "#7 /usr/local/var/www/htdocs/test-core/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel-&gt;sendRequestThroughRouter(Object(Illuminate\\Http\\Request))",
        "#8 /usr/local/var/www/htdocs/test-core/public/index.php(54): Illuminate\\Foundation\\Http\\Kernel-&gt;handle(Object(Illuminate\\Http\\Request))",
        "#9 /Users/sujitbaniya/.composer/vendor/laravel/valet/server.php(147): require('/usr/local/var/...')",
        "#10 {main}"
      ]
    }
  </code></pre>
  
  <p>The laravel version I'm using is <code>5.5</code>. Can anyone suggest me why this error occurred and what might be the solution?</p>
  
  <p><strong>UPDATED</strong></p>
  
  <pre><code>//standardsTree = vnd
  //subtype = insta
  public function parse(Request $request, $strict = false)
      {
          $pattern = '/application\/'.$this-&gt;standardsTree.'\.('.$this-&gt;subtype.')\.([\w\d\.\-]+)\+([\w]+)/';
  
          if (! preg_match($pattern, $request-&gt;header('accept'), $matches)) {
              if ($strict) {
                  throw new BadRequestHttpException('Accept header could not be properly parsed because of a strict matching process.');
              }
  
              $default = 'application/'.$this-&gt;standardsTree.'.'.$this-&gt;subtype.'.'.$this-&gt;version.'+'.$this-&gt;format;
  
              preg_match($pattern, $default, $matches);
          }
  
          return array_combine(['subtype', 'version', 'format'], array_slice($matches, 1));
      }
  
  Passed Header: Accept application/json
  </code></pre>