tracker issue : CF-3858939

select a category, or use search below
(searches all categories and all time range)
Title:

cfthrow inside REST component seems to have stopped working as of update 14. Always returns '204 No Content'

| View in Tracker

Status/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:

Hi turtmcfly, I tried using cfthrow in the CFC and its working. I am getting the correct status code that is thrown from CFC. Can you try this? If you want to send any content for any rest request put it in content parameter so that it goes in the body of the response. Here is the sample code: <cfset response=structNew()> <cfset response.status=400> <cfset response.content="<customer id="&id&"><name>"&name&"</name></customer>"> <cfset response.headers=structNew()> <cfset response.headers.location="http://localhost:8500/rest/RestBug"> <cfset RestSetResponse( response ) /> If you are still facing the problem, can you provide me the repro case. Regards, Hari
Comment by HariKrishna K.
9927 | November 28, 2014 05:59:26 AM GMT
Hi turtmcfly, Can you pls confirm, if this is working?
Comment by HariKrishna K.
9928 | December 03, 2014 01:36:30 AM GMT
Since there has been no response, closing the bug. If you are still facing the issue, please revert with a reproducible case, will re-open the bug.
Comment by HariKrishna K.
9929 | December 08, 2014 02:41:32 AM GMT
Hi Hari, I never get notified when an engineer adds a comment on a ticket (even when I'm the one that filed the ticket). I only get notified when the ticket status changes. If you change the ticket status to PRNeedInfo, then turtmcfly will likely get a notification. turtmcfly may not have replied to your question here due to lack of bugbase notification. Just FYI. Thanks!, -Aaron
Comment by External U.
9930 | December 08, 2014 04:13:20 AM GMT