Skip to content

http: remove pointless uses of arguments - #10664

Merged
cjihrig merged 2 commits into
nodejs:masterfrom
cjihrig:arguments
Jan 10, 2017
Merged

http: remove pointless uses of arguments#10664
cjihrig merged 2 commits into
nodejs:masterfrom
cjihrig:arguments

Conversation

@cjihrig

Copy link
Copy Markdown
Contributor
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

lib

Use of arguments generally only causes problems. This PR removes several uses that serve no purpose at all.

@nodejs-github-botnodejs-github-bot added fs Issues and PRs related to the fs subsystem / file system. http Issues or PRs related to the http subsystem. labels Jan 6, 2017
@mscdex

mscdex commented Jan 6, 2017

Copy link
Copy Markdown
Contributor

With the http changes for example, the error messages now no longer reflect what is being tested, so they would need to be changed. Either way those http changes might be semver-major because of the change in behavior?

@cjihrig

Copy link
Copy Markdown
ContributorAuthor

I was trying to avoid semver-major, but I can make that change. If name isn't a string, toLowerCase() will crash later on in both functions.

@targos

Copy link
Copy Markdown
Member

+1 for the early error but the message should be updated to say that a string is required

Comment threadlib/_http_outgoing.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmm... I think this technically makes this a semver-major because of the change in why the error is thrown, although there would be no way of triggering that difference so it likely wouldn't matter. Therefore I'm +1 with this part as semver-patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What do you mean? If someone does getHeader(undefined) for example it now throws a different error. An argument was supplied, now it's just the wrong type.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good point... hmmm... yeah, there may not be a way around making this a semver-major

@jasnell

Copy link
Copy Markdown
Member

Changing the message to indicate that a string is required would force it to be semver-major

@cjihrig

Copy link
Copy Markdown
ContributorAuthor

I'm going to update the error and make it an uncontroversial semver major.

@cjihrigcjihrig added the semver-major PRs that contain breaking changes and should be released in the next major version. label Jan 6, 2017
Comment threadlib/_http_outgoing.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

TypeError

@jasnell

Copy link
Copy Markdown
Member

A new/updated test may be worthwhile also

@cjihrigcjihrig changed the title lib: remove pointless uses of argumentshttp: remove pointless uses of argumentsJan 10, 2017
@cjihrig

Copy link
Copy Markdown
ContributorAuthor

The changes to lib/fs.js are gone since 3c2a936 landed.

Pushed another commit that updates the relevant test @jasnell.

@cjihrig

Copy link
Copy Markdown
ContributorAuthor

PR-URL: nodejs#10664
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#10664
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@cjihrig
cjihrig merged commit 2d2a059 into nodejs:masterJan 10, 2017
@cjihrig
cjihrig deleted the arguments branch January 10, 2017 19:05
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
PR-URL: nodejs#10664
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
PR-URL: nodejs#10664
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
targos pushed a commit that referenced this pull request Jan 28, 2017
PR-URL: #10664
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
PR-URL: nodejs#10664
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
PR-URL: nodejs#10664
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@italoacasasitaloacasas mentioned this pull request Jan 31, 2017
@jasnelljasnell mentioned this pull request Apr 4, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fsIssues and PRs related to the fs subsystem / file system.httpIssues or PRs related to the http subsystem.semver-majorPRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@cjihrig@mscdex@targos@jasnell@lpinca@nodejs-github-bot