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

Update read-only.js #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Update read-only.js #10

wants to merge 4 commits into from

Conversation

devonatdomandtom
Copy link

Added check to see if body is empty to prevent sql error 'syntax error at or near "WHERE"'

Added check to see if body is empty to prevent sql error 'syntax error at or near "WHERE"'
Removing whitespace
Removing last trailing whitespace
@devonatdomandtom
Copy link
Author

@ mrfelton I wonder if these are valid tests? If we're only updating readonly model attributes, shouldn't we return a 403? Can I amend the test?

if (properties) {
debug('Creating %s : Read only properties are %j', Model.modelName, properties);
Object.keys(properties).forEach(function(key) {
if (!properties) return next(err);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the response a 403 given a model using this mixin where the mixin options = an empty object?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error seems inappropriate in general if the goal is to address an empty body and subsequent SQL errors when using SQL connectors.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we create a new error and response code you think?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, just noticed the SQL errors will happen for empty bodies against the remote to update attributes when using the SQL connectors... maybe the solution should be somewhere else at a lower level?

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.

2 participants