enyo.AjaxSource not properly changing method on a model commit

The commit method of enyo.AjaxSource always sends the request as a "PUT" even if the model is "New". This appears to be a bug. Looking at the source code for the commit method of enyo.AjaxSource we see:
/**
* Implementation of {@link enyo.Source.commit}.
*
* @see enyo.Source.commit
* @public
*/
commit: function (model, opts) {
    opts.method = model.isNew? 'POST': 'PUT';
    opts.url = this.buildUrl(model, opts);
    opts.postBody = opts.postBody || model.toJSON();
    this.go(opts);
},
The first line of the method opts.method = model.isNew? 'POST': 'PUT'; references model.isNew, however, this is not a property of enyo.Model. Since this will always return undefined in any implementation that does not add it, the opts.method will always be set to "PUT".

Comments

Sign In or Register to comment.