7 Replies
Thanks for tagging me @rubenf. I'll look through relevant sources and get back to you in less than a minute.
-----------------------------
While I generate an answer, here are some sources that might be helpful:
* Custom Response Code
* Go Quickstart
* Webhooks
* GET /workers/custom_tags
-----------------------------
Answer
In Windmill, you can return custom status codes from your scripts for synchronous run jobs endpoints. When your script's response contains a key named
windmill_status_code
with a numerical value, that value will be used as the status code of the response (1) (2) .
As an example, if you want to return a 201 status code, your script's response should include {"windmill_status_code": 201}
.
Please note this only applies to synchronous run jobs endpoints (2) .Feel free to tag me @Ask Inkeep for any follow-ups on this thread. Also appreciate any feedback, it helps me improve.
@Ask Inkeep Would this work?
return '{"windmill_status_code": 401}'
Thanks for the follow-up, @netpro25. I'll get back to you soon.
-----------------------------
While I generate an answer, here are some sources that might be helpful:
* Custom Response Code
* Go Quickstart
* Webhooks
* GET /w/{workspace}/inputs/list
-----------------------------
Answer
Yes, your response would correctly return a 401 status code, as it follows the format stated in Windmill's documentation (1) . The key
windmill_status_code
with its value set to 401 would set the HTTP status code of the response. Remember that this only applies for synchronous run job endpoints.Feel free to tag me @Ask Inkeep for any follow-ups on this thread. Also appreciate any feedback, it helps me improve.