restSetResponse

Sets the custom responses.

restSetResponse(response);

Argument Reference for the restSetResponse function

response

Required: Yes
A struct that contains the response details.

Examples sample code invoking the restSetResponse function


Tag Syntax

restSetResponse() can only be used on function with a return type of void. It will cause errors if it is used on functions that have any other return type.

<cffunction name='create' httpMethod='POST' produces='application/xml'> 
 <cfargument name='id' type='numeric'> 
 <cfargument name='name' type='String'> 
 <cfset var response={ 
 status=201, 
 content='<customer id='&id&'><name>'&name&'</name>
 </customer>'>, 
 headers={ 
 location='http://localhost:8500/rest/CustomerService/customers/123', 
 } 
 }> 
 <cfset restSetResponse(response)> 
 <cffunction> 

Fork me on GitHub