And it works, thanks @trichetriche. The problem was in my RequestOptions
, apparently, you can not pass params
or body
to the RequestOptions
while using the post. Removing one of them gives me an error, removing both and it works. Still no final solution to my problem, but I now have something to work with. Final working code.
public post(cmd: string, data: string): Observable<any> {
const options = new RequestOptions({
headers: this.getAuthorizedHeaders(),
responseType: ResponseContentType.Json,
withCredentials: false
});
console.log('Options: ' + JSON.stringify(options));
return this.http.post(this.BASE_URL, JSON.stringify({
cmd: cmd,
data: data}), options)
.map(this.handleData)
.catch(this.handleError);
}