-
Notifications
You must be signed in to change notification settings - Fork 98
JSON-formatted '/status' API response + generic cleanup #3038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
The /status API call can now return usable JSON data
|
@sdargoeuves @captainpacket -- here's the API implementation of "netlab status" as a usable data structure. I also did a bit of a cleanup, hopefully resulting in a more generic "get" method that can handle multiple multi-part requests. I wanted to retain the "old" /status results in case anyone already uses them, so you get the JSON data structure back only with "/status/json" or "/status/json/instance". I would love to have a better idea how to handle that. Any suggestions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds JSON-formatted responses to the /status API endpoint and refactors the API request handler routing logic for better maintainability.
Changes:
- Added generic
send_replyandsend_errorhelper functions for consistent response handling - Enhanced
/statusendpoint to support JSON output and instance-specific queries - Refactored GET request routing to use separate handler dictionaries for simple and path-based endpoints
- Updated default bind address to use
external_commands.get_local_addr()instead of hardcoded localhost - Added KeyboardInterrupt handling and improved server startup logging with protocol information
The /status API call can now return usable JSON data