-
Notifications
You must be signed in to change notification settings - Fork 1
Response
Marlon Carvalho edited this page Jul 20, 2015
·
4 revisions
You're able to return anything you want from your API method: Strings, Lists, Maps, and even your own objects. But returning these kind of objects doesn't permit you to change the status code of your response. It's only possible when you return a Response
object as follows:
@API(path: 'beers')
class BeerAPI {
@GET()
Response hi() {
return new Response()
..statusCode = 200
..body = "Hi!";
}
@GET(':id')
Response get() {
return new Response()
..statusCode = 200
..entity = new MyEntity();
}
}