Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)
Created: 04/19/2013
Components: Documentation
Versions: 10.0
Failure Type:
Found In Build/Fixed In Build: Final / 287252
Priority/Frequency: Major / Some users will encounter
Locale/System: English / Windows 7 64-bit
Vote Count: 1
snippet in the docs:
You must set the returntype attribute of the function to void when a custom response is returned using the function restSetResponse.
Note that it says no such thing against the docs for the actual function (which would be the most sensible place to mention it), just in this devnet article. I have annotated the docs to point this out.
The Stackoverflow question makes a good point:
It works well, except that it forces you to set the function's returntype to "void". The problem with "void" is that whenever I throw an exception, it no longer returns the proper JSON error message.
And they're right. It's entirely reasonable that a method might only conditionally furnish its response via this restSetRespose(), and otherwise respond by returning stuff (be it an error in this case, or any other sort of response). It makes no sense to me that whether or not restSetResponse() works is based on the return type of the method.
Refs:
http://adamcameroncoldfusion.blogspot.co.nz/2013/03/restsetresponse-requires-method-to-be.html
http://stackoverflow.com/questions/15711287/coldfusion-10-rest-api-how-to-set-status-code-201-without-restsetresponse
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3546046
External Customer Info:
External Company:
External Customer Name: Adam Cameron.
External Customer Email:
External Test Config: My Hardware and Environment details:
Attachments:
Comments: