From ef57ee5026f5258184805cb51c0767a76f4f27cd Mon Sep 17 00:00:00 2001 From: Robert Horlings Date: Wed, 14 Jan 2015 17:01:41 +0100 Subject: [PATCH] Bugfix in api authentication to return JSON again --- grails-app/controllers/api/ApiController.groovy | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/grails-app/controllers/api/ApiController.groovy b/grails-app/controllers/api/ApiController.groovy index d235e184..0b031c44 100644 --- a/grails-app/controllers/api/ApiController.groovy +++ b/grails-app/controllers/api/ApiController.groovy @@ -87,7 +87,14 @@ class ApiController { response.status = 500 result = ['error':e.getMessage()] } - return result + + response.contentType = 'application/json;charset=UTF-8' + + if (params.containsKey('callback')) { + render "${params.callback}(${result as JSON})" + } else { + render result as JSON + } } /**