title: Angular 4 http throws error on PUT response without body
body: <p>I am using Angular http module v4.4.6. When the Angular application (client) is sending a PUT request (using <code>HttpClient</code>) to the server, and the server responses a status 200 (OK) without any data in body, angular http module throws an <code>HttpErrorResponse</code>.</p>
  
  <p>Is this a proper feature or a bug?<br>
  How to handle PUT responses without any data in body?</p>
  
  <hr>
  
  <p>In Detail:</p>
  
  <p>In recent versions I have used normal <code>Http</code> module and it's  method put(). There I need to call <code>res.json()</code> to get the JSON data in body. The put() method returns <code>Observable&lt;Response&gt;</code>.</p>
  
  <p>Now I use the newer <code>HttpClient</code> and it's put() method. This method returns <code>Observable&lt;Object&gt;</code>. It seems that the <code>json()</code> method is called internally and leads to the error I see.</p>
  
  <ul>
  <li>Angular client creates PUT request with HttpHeader <code>'Content-Type': 'application/json'</code>. This results in a HTTP PUT request header <code>Accept:application/json, text/plain, */*</code>).</li>
  <li>The server answers with status 200 (OK) and without any data in the body.</li>
  <li>The Angular client receives the answer and throws the error.</li>
  </ul>
  
  <p><code>
      HttpErrorResponse {headers: HttpHeaders, status: 200, ...
           error:
             error: SyntaxError: Unexpected end of JSON input at ..
           text: ""
           headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: ...
           message: "Http failure during parsing for ...
           name: "HttpErrorResponse"
           ok: false
           status: 200
           statusText: "OK"
           url: ...
  </code></p>