Is there a way for a Suitelet to return a non-2xx ...
# suitescript
m
Is there a way for a Suitelet to return a non-2xx response code?
n
Can throw a error or return an object with {status: "Not Ok", code: "401"}
m
I really need to set the actual http response code as it's an external integration with a webhook and any 2xx response is treated as a success
j
I've experimented with this in the past and I don't think there's a way. IIRC uncaught errors produce a 206 partial content response. The response body is an html document. For my internal uses I've just resorted to an object with a boolean
success
. @michoel Maybe you already thought of this, but if you need non-2xx response I think the only option is to have a server between the webhook and the suitelet that translates your suitelet response to the right http code
m
Thanks for confirming, it's pretty annoying to have to introduce middleware just for that