Angular HttpClient returns null value for response of zero

Viewed 5409

I have migrated my Angular 4 service from old Http to the new HttpClient. A request that is returning plain zero 0 as the response, is returning an observable with null.

The request:

return this.httpClient.get(url, options)
  .do(res => console.log('service returns', res)) as Observable<number>;

will console log null, but when I open that request in devtools > Network, I see that the server responded with 0.

What am I doing wrong?

1 Answers
Related