tdegrunt/mongodb-rest — Issue #24: POST response could (should?) include JSON for newly created resource
Author: zuk
Created: 2012-02-23 19:07:07+00:00
State: open

Currently a successful `POST` (create) results in a response that just says `{"ok":1}` and provides a Location header with the URL where the newly created resource can be retrieved.

This is problematic in several cases. For one, it will generally not work for POSTs done over CORS, because (for very bad reasons), the "Location" header is stripped by browsers from CORS responses. This makes retrieving info about the resource after creation impossible.

It also just doesn't work with certain REST libraries—`batman.js`'s RestStorage is one I've had problems with—because they expect the newly created resource's data be available in the POST response body.

I'm willing to implement a solution to this. Maybe an optional config setting to enable returning the resource JSON in the POST response? But is there a good reason why I might not want to implement this?