-
-
Notifications
You must be signed in to change notification settings - Fork 971
Closed
Description
Describe the bug
- Node.js version:
- OS & version:
Currently , the agent type is:
Lines 44 to 48 in 23b2f26
| export type Agents = { | |
| http?: HttpAgent | false; | |
| https?: HttpsAgent | false; | |
| http2?: unknown | false; | |
| }; |
as you can see, false is a valid type, but when i set agent to false, it throws an error!
Lines 1136 to 1146 in 23b2f26
| set agent(value: Agents) { | |
| assert.plainObject(value); | |
| // eslint-disable-next-line guard-for-in | |
| for (const key in value) { | |
| if (!(key in this._internals.agent)) { | |
| throw new TypeError(`Unexpected agent option: ${key}`); | |
| } | |
| // @ts-expect-error - No idea why `value[key]` doesn't work here. | |
| assert.any([is.object, is.undefined], value[key]); |
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
- I have read the documentation.
- I have tried my code with the latest version of Node.js and Got.
andylizi
Metadata
Metadata
Assignees
Labels
No labels