Hello I have this code:
save<T>(url: string, data:any, headers = null): Observable<T>{
return this.http
.post(url, data, headers)
.map(x =>{
return x.json() as T
} )
.catch(error => {
this.app.handleError(error, errorMessage);
return Observable.throw(error);
}).share();
}
And when i send request to action which return empty response (_body: "")
I have error SyntaxError: Unexpected end of JSON input in x.json()
How to check when body isnt empty? Thank you