-
Notifications
You must be signed in to change notification settings - Fork 178
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
feat: add http health API #763
Conversation
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.
❤️
/// Enable health endpoint. | ||
/// Allows you to expose one of the methods under GET /<path> The method will be invoked with no parameters. Error returned from the method will be converted to status 500 response. | ||
/// Expects a tuple with (<path>, <rpc-method-name>). | ||
pub fn health_api(mut self, path: impl Into<String>, method: impl Into<String>) -> Self { | ||
self.health_api = Some(HealthApi { path: path.into(), method: method.into() }); | ||
self | ||
} |
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.
The docs are rather confusing. I needed to read the code to fully understand on what this is doing.
And why is the method called health_api
? Couldn't this theoretically be any kind of endpoint? (which is already implicitly supported, because path
can be anything)
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.
yepp, you are correct.
I did the fastest possible way and did the same as the jsonrpc crate
does.
Sure let's open an issue and do something better.
No description provided.