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.

List of all current handlers

See original GitHub issue

Feature

It would be helpful to know the list of active handlers at a given point of time. For eg. when used for testing, I would like to know already present handlers. It is a bit easier to debug. It could easy to track when server.use is used to add more handlers.

Solution

It would be quite simple, API could be something like server.listHandlers(), which would return all the active listeners.

Current Alternative

The current alternative is to use onUnhandledRequest and kind of guess the typo in the request handler.

PS: I would be happy to give PR if this is a feature that others would want to have too.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
kettanaitocommented, Nov 24, 2020

You can now list the current handlers with the .printHandlers() method.

  • Documentation
  • Works for both worker.printHandlers() and server.printHandlers()

Thank you for the suggestion, @balavishnuvj. This feature can be extremely useful.

0reactions
balavishnuvjcommented, Nov 8, 2020

this is awesome 🥳. I haven’t come across a use case for a matcher function yet, sounds useful though.

We can name it handlers, attachedHandlers. Though I don’t huge DX issue even if it list or listHandlers

Read more comments on GitHub >

github_iconTop Results From Across the Web

logging.handlers — Logging handlers — Python 3.11.1 ...
The following useful handlers are provided in the package. Note that three of the handlers ( StreamHandler , FileHandler and NullHandler ) are...
Read more >
apache2: Get a list of registered handlers - Server Fault
Is it possible, to get a list of all handlers from apache? With setHandler it is possible to create handlers.
Read more >
how to get list of all registered synthetic event handlers ...
In this case, we filter all props with getListeners that start with "on" because every event listener in React starts with "on". You...
Read more >
printHandlers() - Api - Mock Service Worker Docs
printHandlers (). Prints the list of currently active request handlers into the stdout of the running process.
Read more >
Event handling (overview) - Event reference - MDN Web Docs
Programmers can create event handler code that will run when an event ... current document see the events sections in Window and Document...
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