title: slim framework withHeader json it does not work
body: <p>Hello everyone, I'm using slim framework for JSON API all responses work but on headers show text / html, the documentation mentions the function <strong>whitHeader</strong>:</p>
  
  <pre><code>    $app = new \Slim\App;
      $app-&gt;get('/new/', function (Request $request, Response $response){
  
          $response-&gt;getBody()-&gt;write(json_encode(['message'=&gt;'ok']));
  
          $response_h = $response-&gt;withHeader('Content-Type', 'application/json; charset=utf-8');
  
          return json_decode($response_h);
      });
  $app-&gt;run();
  </code></pre>
  
  <p>When using <strong>$response_h-> getHeaders ();</strong> show json header(work) but when running takes another header, I tracked where it replaces the header and is in <strong>slim / slim / container.php</strong> exactly in current function <strong>registerDefaultServices</strong> i replace:</p>
  
  <pre><code>Headers $ headers = new (['Content-Type' =&gt; 'text / html; charset = UTF-8']);
  </code></pre>
  
  <p>to</p>
  
  <pre><code>Headers $ headers = new (['Content-Type' =&gt; 'application / json; charset = utf-8']);
  </code></pre>
  
  <p>but it is not the best way, how change the headers?</p>
  
  <p>and try using:</p>
  
  <pre><code>$ app-&gt; response () -&gt; header ();
  $ app-&gt; response () -&gt; setHeader ();
  </code></pre>
  
  <p>In all the return is that the response function () does not exist.</p>