webhookd
webhookd copied to clipboard
Returning HTTP status codes
Hello,
I want to send errors back when the parameters are wrong and I think it is not a nice way to send an error back with 200 OK. Is there a way to set the HTTP status code of the response?
Hello, the script execution is returned in real time by Webhookd using a streamed HTTP response (Server Sent Event). Because of that, the HTTP code is already sent before the script execution starts. Therefore a problem detected within the script cannot influence the return code.
Thats a shame, I could see real value in a simple tool to run a script / tool and have the exit code of that script determine the http response code to the originating client making the request
Would it be a possible way to disable SSE and therefore are able to send HTTP codes? This would really help.
I'm working on an optional blocking mode. This allows you to obtain the HTTP response code relative to the script's output code. Here the behavior: https://github.com/ncarlier/webhookd/blob/7f3dfc472d243d5d586d0f01970074337a5d8715/README.md#webhook-call