I'm using angular 5 and making a post request with XML data(as my backend only accepts data in XML format). I want to change the Content-Type of header to application/xml but it always sends request with text/plan. Please look into it and let me know what I'm doing wrong.
Here is my Code
import { Injectable } from '@angular/core';
import { HttpClient , HttpHeaders, HttpRequest } from '@angular/common/http';
import { Response, Http, RequestOptions ,Headers } from '@angular/http';
import { Observable } from 'rxjs';
import 'rxjs/add/operator/catch';
import 'rxjs/add/observable/throw';
import 'rxjs/Rx';
import * as xml2js from 'xml2js';
@Injectable()
export class ApiService {
constructor( private httpClient: HttpClient, private http: Http ) { }
signin(){
let header = new HttpHeaders();
header.append('Content-Type', 'application/xml');
header.append('Accept' , 'application/xml');
console.log("Checking Content-Type: " , header.get('Content-Type'));
let body = '<request>' +
'<username>Ken</username>' +
'<password>sparks</password>' +
'</request>';
return this.httpClient.post('https://Ip:8002/?event=account_login', body , {headers:header});
}
}
Here is my Network