ladjs / superagent

Ajax for Node.js and browsers (JS HTTP client). Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.
https://ladjs.github.io/superagent/
MIT License
16.58k stars 1.33k forks source link

superagent returns Error: Parser is unable to parse the response #1642

Open qianzhonglue opened 2 years ago

qianzhonglue commented 2 years ago

my script file as follows

` var url = this.buildUrl(path, pathParams); var request = superagent(httpMethod, url);

    request.type('application/json');
    ....
    request.end((error, response) => {
        if (callback) {
            var data = null;
            if (!error) {
                try {
                    data = this.deserialize(response, returnType);
                    if (this.enableCookies && typeof window === 'undefined') {
                        this.agent.saveCookies(response);
                    }
                } catch (err) {
                    error = err;
                }
            }
            callback(error, data, response);
        }
    });`

Usually this code works fine. But when return type is 'String' it returns "Error: Parser is unable to parse the response". I captures response frame by wireshark, it seems no problem . shrke I don't know what's wrong