I want to check if my response has content in the body. I would have thought that res.totalBytes would do it, but it is always undefined.
this.http.get(this.url, this.options)
.toPromise()
.then( (res) => {
console.log("totalBytes: "+res.totalBytes);//outputs 'totalBytes: undefined'
console.log("res body: "+JSON.stringify(res.json()));//outputs a great big JSON object just as I would expect.
});
What's the best way to check if the body is empty (ideally without relying on an exception being thrown), and why is totalBytes always undefined even when the body has a great big object in it?