Closed ahwatts closed 10 years ago
I thought that the standard was to name hooks based ending with -hook
, so es-response-hook
, is this correct?
Also, why is the es-response-functions
"abnormal"? It seems that it would only be called when the result of a request is successful, what do you think about calling it es-successful-response-hook
instead? (And maybe adding one for es-failed-response-hook
)
Ahh okay, I see your comment in the other thread about the standard for non-normal hooks to be -functions
. That makes more sense then.
What do you think about making it es-successful-response-functions
and es-failed-response-functions
?
That's a good idea. Then I could write a separate function on that hook that turns ES's sometimes-esoteric error messages in to something more readable.
Sounds good, I'm planning on writing something to transform ES responses into org-mode tables so I can graph numeric fields, hooks/functions would be a great way to do it.
+1, this looks good to me. I'm going to merge and we can have a separate refactor PR for the 3-option header elision.
Actually, I noticed an issue with cadadr
not requiring cl
. During merge I'll add (require 'cl-lib)
and change it to (cl-cadadr ...)
Thanks for this feature @ahwatts ! :)
Woot!
This adds the hook es-response-functions, which is run with the response body on 2xx requests.