Honey
Honey

Reputation: 133

Getting a 204 No Content response when I use restSetResponse in Coldfusion 10 REST

I am trying to use restSetResponse to set my own status and content as described in the docs here:

http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSe61e35da8d318518-5719eac51353e6bb244-7fec.html

Here is my REST method:

remote any function test() httpmethod="get" {
    var response = {
        status: 400,
        content: 'something is wrong'
    };
    restSetResponse(response);
}

Any help would be greatly appreciated. Thanks!

Upvotes: 0

Views: 675

Answers (1)

Clarke Schroeder
Clarke Schroeder

Reputation: 226

In the link you provided, note the first numbered bullet under the "Send custom success responses using restSetResponse" heading. If you define the CFC as REST service, you need to ensure the returnType is set to "void". In your example, you have your returnType set to "any".

Upvotes: 1

Related Questions