You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two methods update and patch and they look very similar. Could you please describe what is the difference between them and maybe add this to the documentation. Thank you!
The text was updated successfully, but these errors were encountered:
Indeed both methods are similar. Both eventually call PATCH request, but they have subtle differences, as update is called with modelName, while patch is called from a URL builder.
it('should make basic update call',(done)=>{letinspectorMiddleware={name: 'inspector-middleware',req: (payload)=>{expect(payload.req.method).to.be.eql('PATCH')expect(payload.req.url).to.be.eql('http://myapi.com/foos')expect(payload.req.data).to.be.eql({title: 'foo'})expect(payload.req.params).to.be.eql({include: 'something'})return{}}}jsonApi.middleware=[inspectorMiddleware]jsonApi.define('foo',{title: ''})jsonApi.update('foo',{title: 'foo'},{include: 'something'}).then(()=>done()).catch(()=>done())})it('should allow builders to be called with patch',(done)=>{letinspectorMiddleware={name: 'inspector-middleware',req: (payload)=>{expect(payload.req.method).to.be.eql('PATCH')expect(payload.req.url).to.be.eql('http://myapi.com/foos/1')expect(payload.req.data).to.be.eql({title: 'bar'})return{}}}jsonApi.middleware=[inspectorMiddleware]jsonApi.one('foo',1).patch({title: 'bar'}).then(()=>done()).catch(()=>done())})
Hello!
There are two methods
update
andpatch
and they look very similar. Could you please describe what is the difference between them and maybe add this to the documentation. Thank you!The text was updated successfully, but these errors were encountered: