sindresorhus / got

🌐 Human-friendly and powerful HTTP request library for Node.js
MIT License
14.32k stars 938 forks source link

Can't set agents when agent type is `false` #2360

Open shellvon opened 5 months ago

shellvon commented 5 months ago

Describe the bug

Currently , the agent type is: https://github.com/sindresorhus/got/blob/23b2f26ea76863bcf58045287eebaa81fcbb99bf/source/core/options.ts#L44-L48

as you can see, false is a valid type, but when i set agent to false, it throws an error!

https://github.com/sindresorhus/got/blob/23b2f26ea76863bcf58045287eebaa81fcbb99bf/source/core/options.ts#L1136-L1146

Actual behavior

Can't set agent when agent type is false

Expected behavior

change type declare (maybe remove false type?) or just make false as a valid type when set agent, I think the latter would be better.

Code to reproduce

// just set agent to false.

Checklist