Skip to content

Validate all the things #10

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

Merged
merged 2 commits into from
May 12, 2015
Merged

Validate all the things #10

merged 2 commits into from
May 12, 2015

Conversation

danielwaterworth
Copy link
Contributor

No description provided.

if (typeof channel !== "string" || channel === "") {
throw new Error("Invalid channel name: '" + channel + "'");
}
validateSocketId(socketId);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we please have some test cases for validating the socket_id?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

}

var validateSocketId = function(socketId) {
if (typeof socketId !== "string" || socketId === "" || !socketId.match(/^\d+\.\d+$/)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is @zimbatm's comment about the required regexp here relevant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

\A and \Z aren't valid in JS. ^ and $ work the same, except in multiline mode. I have checked this.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

WillSewell added a commit that referenced this pull request May 12, 2015
@WillSewell WillSewell merged commit 0b1dfe4 into master May 12, 2015
@WillSewell WillSewell deleted the validate_socket_id branch May 12, 2015 11:30
kashif pushed a commit to kashif/pusher-http-node that referenced this pull request May 18, 2015
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.

3 participants