Sign Up
Loading...

Setting custom status codes in API output

Asked by tien97 on December 3, 2024

How can I set a custom HTTP status response for an endpoint output?


Answered by Twidget

Successful responses default to HTTP 200. Use the validate function to detect invalid input and throw an error — that will return an appropriate non‑200 status code. See the linked tutorial for details.

https://www.youtube.com/watch?v=FAbQP37ImUI

Related Questions