Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PUT on the default endpoint generator broken #2205

Open
Assignees
Milestone
@rufogongora

Description

I just generated an endpoint with the generator and I'm getting some weird functionality on it, doing a PATCH request won't work at all and PUT does some weird stuff like it updates some field of other models.

I'm using an AngularJS $resource PUT request, for example my resource would look like this:
return $resource('/api/thing/:id', {id: '@_id'},{ 'update' : {method:'PATCH'} })

After that on the controller I would do:

this.thing.$update((data)=>{console.log(data)})

What I ended up doing was that I went back to the lodash approach instead of jsonpatch and it worked for me.

Instead of using the jsonPatch "PatchUpdates" function I'm using this one

function saveUpdates(updates) {
 return function(entity) {
 var updated = _.merge(entity, updates);
 return updated.save()
 .then(updated => {
 return updated;
 });
 };
}

While this is working I'm wondering if the issue is with jsonpatch itself or otherwise, because I'm using the out of the box upsert function and it messes my other data, or is my understanding of upserting wrong?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    AltStyle によって変換されたページ (->オリジナル) /