Support blocking queries to /health#3
Support blocking queries to /health#3chrisDeFouRire wants to merge 3 commits intosilas:masterfrom chrisDeFouRire:master
Conversation
|
I was thinking about exposing That seem like an acceptable solution to you? |
|
Hi ! Do you mean having (err, res) as a callback for all calls ? or (err, data, res) ? The first option would break all existing code... the latter sounds good to me... |
|
Woops, I mean't the third parameter. So the callback signature would be |
|
it sounds like a good option... |
|
as for testing, it would be cool if you could tell me about your test configuration: maybe I could build a Vagrant file for easy setup of the 3 nodes... |
|
So you should just need Basically the helper.js script spawns a mini-cluster and waits for it to boot up. I'm going to spend some time this weekend integrating your changes and writing some nock stubs for the current tests so it's easy to run the tests even without the above setup. |
|
Let me know if you run into issues, thanks for reporting! |
|
Nice use of middlewares in rapi :-) |
Here's a very modest proposal for enhancement, to make it possible to use blocking queries with
consul.health.*endpoints... It's backwards compatible...To use blocking queries, you must provide the
?index= paramwhich you obtained in the response headers of the previous call.healthHTTP responses do not include aModifyIndexfield like thekvones. Instead, you must use theX-Consul-IndexHTTP header... But inconsul.health, only theres.bodyis returned.This modification adds an optional
headersparameter to the callback so the caller can get theX-Consul-Indexor other consul specific headers (do we have a leader ? time of last contact) as per the consul.io docs...If the caller implements a classic 2 params callback, the headers are silently discarded.
If he implements the 3 params callback, he'll receive the headers.
What do you think ?
Example headers: