What does this error mean — Uncaught TypeError: Already read?

前端 未结 2 1589
余生分开走
余生分开走 2020-12-14 14:24

In Javascript, when is this error thrown?

index.js

/**
 * Created by tushar.mathur on 24/12/15.
 */
\'use strict\'

const _         


        
2条回答
  •  时光说笑
    2020-12-14 14:38

    This error means you have resolved the promise (in this case, you use Body.json()) more than once.

    You can check the response body methods from the ref I attached below and you need a flag to check if the promise has been resolved or not: in this case, you can use Body.bodyUsed

    Reference: https://developer.mozilla.org/en-US/docs/Web/API/Response

    HTH

提交回复
热议问题