-
Notifications
You must be signed in to change notification settings - Fork 15
Store response for newly created resources #42
Comments
Hey @mjallday currently it just does a redirection automatically. The idea being you aren't really interested in the 201 response, just in the location of the newly created resource. Of course, in real life, you often can't control the api itself, so this behavior is annoying (sorry). I had a start on a similar issue in #29 but I haven't finished it. |
Right. What's the thinking with this line? I'm not too familiar with HTTP APIs that don't return a body on a 201. Seems like 202 would be more accurate in this case? |
The idea is that a resource has been created, and we want to return you a Again, that's the spec, in reality if your api retuns stuff in the 201 body On Thu, Nov 19, 2015, 16:30 Marshall Jones notifications@github.com wrote:
|
Following on from this, assuming that you're already using an authenticated navigator this should not be an issue. Using the next branch you would simply be able to do the following. N = restnavigator.Navigator.hal(api, auth=(user, password))
N_new_user = N['users'].create(payload) Then proceed to use the N_new_user navigator as you please, as although the create will not bind the result, it will fetch the data upon use. |
IF I call
POST /users
I cannot get the result of the initial call if theLocation
header is set.This is difficult for me because this call to
/users
returns a set of credentials for operating on the API and is subsequently needed for authentication.What's the recommended way to work around this? I see that in the source code the response is discarded if the Location header is set regardless of if there is a body or not.
According to this wikipedia article about the Location header should always be sent on 201 responses.
The text was updated successfully, but these errors were encountered: