Axios tuner interface error problem Error: Parse Error

node 10.14.2 use axios to call this interface https://stock.xueqiu.com/v5/stock/realtime/quotec.json?symbol=SH600926 to report an error. The error message is

.
{ Error: Parse Error
    at Socket.socketOnData (_http_client.js:442:20)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:94:17)

but this API can return data directly in the browser, and it can also be called in postman. This error message appears to be an error of the code, but the code seems to be fine. Is it the code below, or is it that this API restriction causes errors, but the error message returned should not be like this if it is restricted?

I hope passers-by can answer.

const axios = require("axios")

const url = "http://stock.xueqiu.com/v5/stock/realtime/quotec.json?symbol=SH600926"
const monit = () => {
    axios.get(url).then((res) => {
        console.log(res)
    })
    .catch((err) => {
        console.log(typeof err);
        console.log(err.code);
        console.log(Object.keys(err)) 
    })
}
monit()

looked up some information, it seems that node is very picky about http headers, some will report errors, not even with the request module. Later, I tried it with superagent, no problem.
https://stackoverflow.com/que...
https://stackoverflow.com/que...
https://cmty.app/nuxt/nuxt.js...

Jul.17,2022

clipboard.png
https://xueqiu.com


try to hit the breakpoint with http.get and print the received data. There should be something wrong with this content-length

.
Menu