Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Resource save operations should follow Location if the server response is 201 Created #2572

@trajano

Description

@trajano

As per the HTTP spec for the 201 Created states, it must have the most specific URI for the resource given in the Location header field.

Therefore it should try to follow the Location field when a 201 status code is returned for non-GET operations.

At the moment I have used the following workaround:

SomeModel.save({ "name": "Archie" },
  function (object, responseHeaders) {
    $http.get(responseHeaders("Location")).success(
      function (newObject) {
        // real success with an object containing IDs.
      });
  },
  function (error) {
    // failure
  }
);

I have put in more details on http://www.trajano.net/2013/05/201-created-with-angular-resource/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions