openfaas

how to return HTTP status code in Open FaaS?


How can a function deployed in openfaas return different HTTP status code to the caller? Like 4xx codes.

As per documentation, the watchdog would process the stdout or stderr for either a http status 200 or 5xx.

Is there a way to change the status like 400, 409 etc? I am using csharp template as downloaded by faas-cli


Solution

  • You cant, as stated here https://github.com/openfaas/faas-netes/issues/147

    The solution suggested is to return a payload with the status code, and parse the payload on the receiving end.