question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

docs: MockAgent.get() documentation is missing required options for MockPool.intercept()

See original GitHub issue

Bug Description

Currently, the MockAgent.get() documentation shows using an implementation of MockPool.intercept() without the (seemingly, both in my own testing and based on what MockPool.intercept() docs say) required method property.

Reproducible By

Trying to run any of the examples in MockAgent.get() documentation that use a ``MockPool.intercept()implementation without themethod` property.

Expected Behavior

Examples should be functioning properly.

Logs & Screenshots

screenshot of my own code where an error occurred nearly identical code on the undici docs

Environment

N/A

Additional context

Should be fixable by just adding the method property to every options object where includes is used.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
bnbcommented, Sep 13, 2022

Ah yes, I’m on 5.8.2. That doesn’t change the need to update docs inconsistency, though 😊

1reaction
KhafraDevcommented, Sep 10, 2022

It says in the types that it defaults to get, which makes more sense than throwing an error imo.

https://github.com/nodejs/undici/blob/0862fba5406ff7d45e3b80cd0aaea952098b5a6c/types/mock-interceptor.d.ts#L47

Read more comments on GitHub >

github_iconTop Results From Across the Web

MockAgent don't intercept Pool requests · Issue #996 - GitHub
a function that takes a Client/Pool and use it to make that request, let's call it execute(); create a MockClient/MockPool and pass it...
Read more >
Mocking With Undici Like a Pro - Fusebit
The basic entrypoint into the mocking system is the MockAgent class, which has a get() method returning a MockClient or MockPool instance, ...
Read more >
undici - UNPKG
This method creates and retrieves MockPool or MockClient instances which can then be used to intercept HTTP requests. If the number of connections...
Read more >
Node.js Undici
Sets the global dispatcher used by Common API Methods. undici.getGlobalDispatcher(). Gets the global dispatcher used by Common API Methods. Returns: Dispatcher ...
Read more >
nock - npm
This setup says that we will intercept every HTTP call to https://api.github.com . It will intercept an HTTPS GET request to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found