title: How to use 'toPromise()' on http.post request that doesn't return data in Angular?
body: <p>I recently started learning Angular (4) and followed the tutorials of Angular.io.</p>
  
  <p>But now that I'm trying to build my own application I'm running into a bit of a problem. I've spent the whole day trying to figuring this out but I failed.</p>
  
  <p>I'm working on an auth service that has only a login and a logout for now.</p>
  
  <p>The <code>login</code> works fine, but I don't get the <code>logout</code> to work. It seems to break on the <code>toPromise()</code> call.</p>
  
  <pre><code>const url = `${environment.serviceURL}/api/account/logout`;
  const headers = new Headers({'Content-Type': 'application/x-www-form-urlencoded',
      'withCredentials':true,
      'Authorization': `Bearer ${this.token}`});
  let options = new RequestOptions({headers: headers});
  let result = this.http.post(
       url, options).toPromise().then(/*do something*/);
  </code></pre>
  
  <p>This gives me the following error in the console:</p>
  
  <pre><code>ERROR Error: Uncaught (in promise): TypeError: v.split is not a function
  TypeError: v.split is not a function at http://localhost:4200/vendor.bundle.js:26382:76
  at Array.forEach (native)
  at http://localhost:4200/vendor.bundle.js:26382:20
  at Map.forEach (native)
  at Headers.toJSON (http://localhost:4200/vendor.bundle.js:26380:23)
  at Object.stringify (&lt;anonymous&gt;)
  at Request.Body.text (http://localhost:4200/vendor.bundle.js:26957:25)
  at Request.getBody (http://localhost:4200/vendor.bundle.js:27865:29)
  at Observable._subscribe (http://localhost:4200/vendor.bundle.js:27393:37)
  at Observable._trySubscribe (http://localhost:4200/vendor.bundle.js:567:25)
  at http://localhost:4200/vendor.bundle.js:26382:76
  at Array.forEach (native)
  at http://localhost:4200/vendor.bundle.js:26382:20
  at Map.forEach (native)
  at Headers.toJSON (http://localhost:4200/vendor.bundle.js:26380:23)
  at Object.stringify (&lt;anonymous&gt;)
  at Request.Body.text (http://localhost:4200/vendor.bundle.js:26957:25)
  at Request.getBody (http://localhost:4200/vendor.bundle.js:27865:29)
  at Observable._subscribe (http://localhost:4200/vendor.bundle.js:27393:37)
  at Observable._trySubscribe (http://localhost:4200/vendor.bundle.js:567:25)
  at resolvePromise (http://localhost:4200/polyfills.bundle.js:3224:31)
  at http://localhost:4200/polyfills.bundle.js:3150:17
  at SafeSubscriber._error (http://localhost:4200/vendor.bundle.js:66387:85)
  at SafeSubscriber.__tryOrSetError (http://localhost:4200/vendor.bundle.js:16367:16)
  at SafeSubscriber.error (http://localhost:4200/vendor.bundle.js:16321:26)
  at Subscriber._error (http://localhost:4200/vendor.bundle.js:16248:26)
  at Subscriber.error (http://localhost:4200/vendor.bundle.js:16222:18)
  at Observable._trySubscribe (http://localhost:4200/vendor.bundle.js:572:18)
  at Observable.subscribe (http://localhost:4200/vendor.bundle.js:555:27)
  at http://localhost:4200/vendor.bundle.js:66387:15
  </code></pre>
  
  <p>The mayor difference is (at least I think) that the <code>login</code> returns data containing the user info and the <code>logout</code> doesn't return any data. It just removes the session in the service.</p>
  
  <p>I just want to know if the request has succeeded so I can act upon it.
  What am I doing wrong or what should I do differently to get this working?</p>