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 HTTP method must be uppercase string (POST vs post) #1403

Closed
@dustinmartin

Description

@dustinmartin

When defining a resource, if you do not have the HTTP method in uppercase (POST vs post) it doesn't work properly but doesn't throw any errors letting you know of a problem.

Here is an example resource definition:

var Project = $resource("api/projects.cfm/:projectID",
    { "projectID": "@projectID" },
    { "query": { method: "GET", isArray: true },
      "get": { method: "GET" },
      "save": { method: "POST" },  // Problems caused if 'POST' is changed to 'post'
      "destroy": { method: "DELETE" } }
);

If I change 'POST' to 'post' a couple things happen.

1.) Any params not defined in the paramDefaults object seem to be ignored completely.

2.) All params are only ever sent as a URL query string.

Since case matters, I think a change should be made in Angular to auto uppercase the HTTP method or throw an error to let the developer know of a problem. At the very least, if no changes is going to be made, the docs should explain this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions