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.57k stars 1.33k forks source link

[fix] TypeError: req.setNoDelay is not a function #1790

Closed Molmin closed 7 months ago

Molmin commented 7 months ago

Describe the bug

Node.js version: 20.9.0

OS version: Ubuntu 22.04.3 LTS

Description:

I used superagent in deno project. I wrote import superagent from 'npm:superagent@8.1.2' and await superagent.get('https://www.bing.com') into index.ts, but it threw this error:

TypeError: req.setNoDelay is not a function
    at Request.request (.../node_modules/.deno/superagent@8.1.2/node_modules/superagent/lib/node/index.js:767:7)
    at Request.end (.../node_modules/.deno/superagent@8.1.2/node_modules/superagent/lib/node/index.js:919:8)
    at .../node_modules/.deno/superagent@8.1.2/node_modules/superagent/lib/request-base.js:266:12
    at new Promise (<anonymous>)
    at RequestBase.then (.../node_modules/.deno/superagent@8.1.2/node_modules/superagent/lib/request-base.js:250:31)
    at eventLoopTick (ext:core/01_core.js:178:11)

Checklist

Molmin commented 7 months ago

I solved it by myself.

Thank you for your perfect project!