title: Angular 6 - httpClient posting an XML file
body: <p>I am using Angular 6 httpClient and have this code in a service:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { HttpClient, HttpHeaders } from '@angular/common/http';
  
  const httpOptions = {
    headers: new HttpHeaders({ 'Content-Type': 'text/xml' })
  };
  
  @Injectable({
    providedIn: 'root'
  })
  export class ApiService {
  
    constructor(private http: HttpClient) { }
  
    post() {
        const postedData = { userid: 1, title: 'title here', body: 'body text' };
        return this.http.post('this url here', postedData, httpOptions).subscribe(result =&gt; {
          console.log(result);
        }, error =&gt; console.log('There was an error: '));
    }
  
  }
  </code></pre>
  
  <p>My question is: I want to post an xml file so how do I modify this code to do that?</p>