I return custom wrapper object with a field for my own internal status codes. The wrapper object is a generic class so the playload/data can be whatever I need to return.
Essentially unless something goes wrong my Endpoints always return 200. The caller has to inspect the object returned to get the true status code. It works fine but I loose a bit of type safety from my endpoints as it's not always clear what type of data the endpoint returns. On Tuesday, May 27, 2014 4:06:44 PM UTC-4, Matthew Flint wrote: > > Hello team, > > We all love REST-full-ness, so I'd like to return more REST-ful status > codes from my endpoints. (Example: 201 CREATED from a POST endpoint which > creates a resource). > > But I can't find any way to set the HTTP status code. Can anyone help > please? > > Some other (sad-path) status codes seem to be driven by throwing an > exception - eg. NotFoundException causes a 404. But I want to return a > different status code *and* XML/JSON in the response. > > Thanks all! > Matthew > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/d/optout.
