Shopify/batman — Issue #339: RestStorage POST success should follow redirect
Author: zuk
Created: 2012-02-23 05:24:56+00:00
State: open

Many RESTful services respond to a `POST` request with a `201` ("created") status, a blank body, and a redirect (i.e. a URL in the response's "Location" header) pointing to the newly created resource. `RestStorage` should follow that redirect to load the newly-created model's data, but right now it just assumes that the resource data will be in the POST response.

I tried my hand at implementing this, but I can't figure out how to get access to the response headers in `RestStorage`'s request callbacks. I'm looking at this line specifically: https://github.com/Shopify/batman/blob/master/src/batman.coffee#L3570

Any advice on what I should be doing here? I get the feeling I might need to attach the response headers to `env` somewhere further up, but no idea where to start looking...