title: How to do JSON request on WebTestCase
body: <p>I install Symfony 4 and then API Platform.</p>
  
  <p>Then I create Test class like this</p>
  
  <pre class="lang-php prettyprint-override"><code>class UserFunctionalTest extends WebTestCase
  {
      /** @var string  */
      protected $host = "https://wikaunting-api.local";
  
      /** @var KernelBrowser */
      protected $client;
  
      protected function setUp()
      {
          $this-&gt;client = static::createClient();
      }
  
      public function testCreateUser()
      {
          $response = $this-&gt;client-&gt;request('POST', $this-&gt;host . '/api/users.json', [
              'json' =&gt; [
                  'username' =&gt; 'jamielann1',
                  'email' =&gt; 'test@example.com',
                  'password' =&gt; 'jamielann1',
              ],
          ]);
  
          $this-&gt;assertEquals(200, $this-&gt;client-&gt;getResponse()-&gt;getStatusCode());
      }
  }
  
  </code></pre>
  
  <p>When I run <code>./bin/phpunit</code>, I got error message</p>
  
  <pre><code>Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException: "The content-type "application/x-www-form-urlencoded" is not supported. Supported MIME types are "application/ld+json", "application/json", "text/html"." at /home/vagrant/Code/testcode/vendor/api-platform/core/src/EventListener/DeserializeListener.php line 130
  </code></pre>
  
  <p>My question is, why it is not received as application/json? What is the proper way?</p>