javascript fetch - Failed to execute 'json' on 'Response': body stream is locked

前端 未结 8 1733
滥情空心
滥情空心 2021-01-30 09:58

When the request status is greater than 400(I have tried 400, 423, 429 states), fetch cannot read the returned json content. The following error is displayed in the browser cons

8条回答
  •  野的像风
    2021-01-30 10:39

    I know it's too late but it can help someone:

    let response = await fetch(targetUrl);
    let data = await response.json();
    

提交回复
热议问题