使用JSON.stringify对FetchAsAdmin
返回的结果进行解包,出现错误
Converting circular structure to JSON\n --> starting at object with constructor 'ClientRequest'\n | property 'socket' -> object with constructor 'Socket'\n --- property '_httpMessage' closes the circle"}
代码如下:
import { FetchAsAdmin } from '@ones-op/fetch'
// ...
try {
const porjectsResp = await FetchAsAdmin({
url: `/openapi/v2/project/projects`,
method: 'GET',
params: {
teamID: 'B5QqUH4h',
},
headers: {
Accept: 'application/json',
},
})
Logger.info('porjectsResp:', porjectsResp.data)
JSON.stringify(porjectsResp) // 报错
} catch (e) {
Logger.error(`porjectsResp`, e)
}