phxdatasec/model-factory — pull request #16 by juristr (2014-12-03 08:52:29+00:00)
Title: Bug: HTTP method is not being taken into account when creating custom actions

Hi,

according to the docs one can create a custom action and overwrite its HTTP method like this:

```javascript
// anything with $ prefix is attached to instance
'$copy': {
type: 'POST',
url: 'stlouis/zoo/copy',
}
```

This doesn't work, however. The problem is that internally the object defined on `$copy` is passed directly to the `$http` service which, however, uses `method` for declaring the HTTP verb rather than `type`:

```
var req = {
method: 'POST',
url: 'http://example.com',
headers: {
'Content-Type': undefined
},
data: { test: 'test' },
};

$http(req)...
```

The test I added (`should correctly invoke the custom model instance function`) proves that using `method` works.

@amcdnl Not sure how you want to correct it. We could simply adjust the docs, but that would cause some trouble for people already using the lib with `type` (although it didn't work anyway so far) :smile: .