Title:
cfthrow inside REST component seems to have stopped working as of update 14. Always returns '204 No Content'
| View in TrackerStatus/Resolution/Reason: Closed/Withdrawn/CannotReproduce
Reporter/Name(from Bugbase): Ian Turton / Ian Turton (turtmcfly)
Created: 11/27/2014
Components: REST Services
Versions: 10.0
Failure Type:
Found In Build/Fixed In Build: Final /
Priority/Frequency: Trivial / Unknown
Locale/System: English / Linux All
Vote Count: 0
Until update 14, using cfthrow in a rest component worked as per the docs here http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSe61e35da8d318518-5719eac51353e6bb244-7fec.html
Now it is returning status 204 - No content
I can return a status using restSetResponse, but if there are no errors and I actually want to return a result set I can't since restSetResponse requires the return type of the function to be set to void. So restSetResonse is fine where your function just needs to return a 'i did/didn't work' e.g. an update or delete, but not much use for GET requests where you could return a result set, but also might want to indicate an error with e.g. parameters
Steps to Reproduce: create a REST function with a cfthrow;
remote struct function retrieveOffer(numeric offerId restargsource="path")
httpmethod="GET"
restpath="{offerId}" {
if (arguments.offerId < 0) {
throw(errorCode = 400, message = "Invalid offer id");
}
return { val1 = "value 2", val2 = "value 2"};
}
Actually, the above is a 'real world' type function. A much simpler function to illustrate the point is;
remote struct function retrieveOffer() {
throw(errorCode = 400, message = "You won't see me!");
}
Actual Result:HTTP status returns '204 No Content' if offer is negative
Expected Result: HTTP Status 400 - You won't see me!
Any Workarounds:None I can see
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3858939
External Customer Info:
External Company:
External Customer Name: turtmcfly
External Customer Email:
External Test Config: Coldfusion 10 Update 14 on Ubuntu Ubuntu 12.04.5
Also tried on Coldusion 11 running on Ubuntu 14.04.1
Attachments:
Comments: