Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed overwrite option: was always true #72

Merged
merged 2 commits into from
Mar 27, 2016
Merged

Fixed overwrite option: was always true #72

merged 2 commits into from
Mar 27, 2016

Conversation

leo-nard
Copy link

The this.overwrite option is always true in its current form.

@marshallswain
Copy link
Member

Thanks for the input. The overwrite:true is actually there by default to conform to the REST spec, which is that on update the object gets replaced. Setting it otherwise would move away from being RESTful, so I think it might be better to leave it so that users need to opt in to overwrite:false.

@marshallswain
Copy link
Member

Sending a PATCH request is a great way to get this same behavior.

@ekryski
Copy link
Member

ekryski commented Mar 26, 2016

Yes @marshallswain is correct. If you don't want that behaviour for your service then you just initialize the service with { overwrite: false }.

Thanks for taking the time to make a PR but this is something that we won't change. 😄

@ekryski ekryski closed this Mar 26, 2016
@leo-nard
Copy link
Author

Agree with above. Though the current code causes this.overwrite always to evaluate to true. See below, if options.overwrite is false it will take the right part of the || operator. The PR is just a fix, the overwrite will still be opt-in.
this.overwrite = options.overwrite || true;

@ekryski ekryski reopened this Mar 26, 2016
@ekryski
Copy link
Member

ekryski commented Mar 26, 2016

Wow. I fail at developing. You are right. Sorry it's been a hectic day.

@ekryski
Copy link
Member

ekryski commented Mar 26, 2016

We will need to make sure the tests pass before we can merge this. I'll have to take a proper look this evening.

@leo-nard
Copy link
Author

No problem. Does the failing of the test has something to do with my PR? Seems harmless :).

@ekryski
Copy link
Member

ekryski commented Mar 27, 2016

Yup syntax error. It should be: (options.overwrite === false) ? false : true;

@leo-nard
Copy link
Author

Sorry. Next time will test this locally :).

@daffl
Copy link
Member

daffl commented Mar 27, 2016

I'll take this one and make a new release that includes #70

@daffl daffl merged commit a30e784 into feathersjs-ecosystem:master Mar 27, 2016
@ekryski
Copy link
Member

ekryski commented Mar 28, 2016

Thanks @leo-nard! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants