从POST返回ID

I've built a web app in angularjs and a service layer using Go and App Engine but I've run into a snag. Angular doesn't seem to recognize the HTTP status 201 (Created) nor the Location header it populates and the gorest library that I've been using up until now will not return any body data for a POST or PUT except for the header on a 201 Create response.

I want to be able to add a new item to a collection in my app and have the server respond with the unique ID for it.

I could make a separate GET request after the POST comes back but that's inefficient and messy. I could also fix the gorest code to allow a body in a response for a non GET verb but it might be that I'm breaking idiomatic standards.

Is there anything I'm missing here?

There's a closed issue on angular.js's issue tracker, they pretty much don't care about that feature.

It looks like I was missing something.

The gorest library automatically marshals the return type from a service method as long as it is a GET. It doesn't allow data to be returned this way with either a POST or PUT.

However I noticed the WriteAndOveride method could allow the body to be set on any type of call:

serv.ResponseBuilder().SetResponseCode(200).WriteAndOveride([]byte(responseBody))

Whilst it doesn't feel like the cleanest solution, it should certainly unblock me.