res.json() is a not a function in HttpClient Angular 2

后端 未结 2 688
失恋的感觉
失恋的感觉 2020-12-19 18:15

I was using Angular Http module before and the method res.json() used to work fine. I have recently tried HttpClient but then the

2条回答
  •  执笔经年
    2020-12-19 18:45

    Right, that's because new http client by default calls res.json() implicitly and you don't need to that manually yourself. Here is the quote from commit:

    JSON is an assumed default and no longer needs to be explicitly parsed

    See Difference between HTTP and HTTPClient in angular 4? for more details.

提交回复
热议问题