I'm trying to get something from a third party server, and I'm using got to make the https, but now it's returning something I can't understand.
let res = got.post('https://c.jushuitan.com/api/open/query.aspx?ts=1632820982&partnerid=ywv5jGT8ge6Pvlq3FZSPol345asd&method=mall.item.query&token=181ee8952a88f5a57db52587472c3798&sign=e101d5a0662dc9723415a941d4f2d606', {
json: {
"modified_begin": "2021-09-06 00:00:00",
"modified_end": "2021-09-07 00:00:00",
"page_index": index,
"page_size": size,
"sku_ids": null
}
})
console.log('2')
console.log(res)
and the return info is like this:
What is this? Am I using got wrong?
The .post()
returns a promise. You need to await
it or handle with .then
From got npm's page :
const {body} = await got.post('YOUR_ENDPOINT', {
json: {
hello: 'world'
},
responseType: 'json'
});
console.log(body.data);
Or you may try:
got.post('YOUR_ENDPOINT', {
json: {
hello: 'world'
},
responseType: 'json'
}).then(result => doSomething(result))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.