You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OS & version: NixOS 22.11.3889.f5364316e31 (Raccoon) x86_64
I noticed that the type definition for the agent option allows undefined as a valid value, but when I pass undefined at runtime, I get an error saying that agent value is expected to be an object.
Actual behavior
➜ testing-got tsc && node dist/index.js
node:internal/process/esm_loader:97
internalBinding('errors').triggerUncaughtException(
^
RequestError: Expected value which is `plain object`, received value of type `undefined`.
at Request._destroy (file:///home/sleroq/develop/other/testing-got/node_modules/got/dist/source/core/index.js:481:21)
at _destroy (node:internal/streams/destroy:109:10)
at Request.destroy (node:internal/streams/destroy:71:5)
at Request.flush (file:///home/sleroq/develop/other/testing-got/node_modules/got/dist/source/core/index.js:240:22)
at lastHandler (file:///home/sleroq/develop/other/testing-got/node_modules/got/dist/source/create.js:37:26)
at iterateHandlers (file:///home/sleroq/develop/other/testing-got/node_modules/got/dist/source/create.js:49:28)
at got (file:///home/sleroq/develop/other/testing-got/node_modules/got/dist/source/create.js:69:16)
at file:///home/sleroq/develop/other/testing-got/dist/index.js:2:7
at assertType (file:///home/sleroq/develop/other/testing-got/node_modules/@sindresorhus/is/dist/index.js:305:15)
at Object.plainObject (file:///home/sleroq/develop/other/testing-got/node_modules/@sindresorhus/is/dist/index.js:377:29)
at set agent [as agent] (file:///home/sleroq/develop/other/testing-got/node_modules/got/dist/source/core/options.js:461:16)
at Options.merge (file:///home/sleroq/develop/other/testing-got/node_modules/got/dist/source/core/options.js:411:27)
at new Options (file:///home/sleroq/develop/other/testing-got/node_modules/got/dist/source/core/options.js:355:26)
at new Request (file:///home/sleroq/develop/other/testing-got/node_modules/got/dist/source/core/index.js:224:28)
at got (file:///home/sleroq/develop/other/testing-got/node_modules/got/dist/source/create.js:31:25)
at file:///home/sleroq/develop/other/testing-got/dist/index.js:2:7
at ModuleJob.run (node:internal/modules/esm/module_job:194:25) {
Expected behavior
I expected the code to run without any errors and print the response body from example.com.
Describe the bug
I noticed that the type definition for the agent option allows undefined as a valid value, but when I pass undefined at runtime, I get an error saying that agent value is expected to be an object.
Actual behavior
Expected behavior
I expected the code to run without any errors and print the response body from example.com.
Code to reproduce
Checklist
The text was updated successfully, but these errors were encountered: