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

doc: http2.createServer options as optional #42832

Merged
merged 1 commit into from
Apr 28, 2022

Conversation

daeyeon
Copy link
Member

@daeyeon daeyeon commented Apr 23, 2022

The method might be designed to explicitly take options. However,
the implementation and many examples already allow the first parameter
of function type. (This is maybe because of Compatibility API.)

function createServer(options, handler) {
if (typeof options === 'function') {
handler = options;
options = {};
}
return new Http2Server(options, handler);

// an example in doc/api/http2.md
const http2 = require('node:http2');
const server = http2.createServer();
server.on('stream', (stream, headers) => { ... });

I'm not sure whether applying the same to http2.createSecureServer is
meaningful. But, seeing https.createServer, the options parameter is
handled as optional.

The method might be designed to explicitly take `options`. However,
the implementation and many examples already allow the first parameter
of a function type.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/http2
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. http2 Issues or PRs related to the http2 subsystem. labels Apr 23, 2022
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@ShogunPanda ShogunPanda left a comment

Choose a reason for hiding this comment

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

LGTM!

@RaisinTen RaisinTen added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 24, 2022
@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 28, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 28, 2022
@nodejs-github-bot nodejs-github-bot merged commit 489e229 into nodejs:master Apr 28, 2022
@nodejs-github-bot
Copy link
Collaborator

Landed in 489e229

targos pushed a commit that referenced this pull request May 2, 2022
The method might be designed to explicitly take `options`. However,
the implementation and many examples already allow the first parameter
of a function type.

PR-URL: #42832
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
@targos targos mentioned this pull request May 2, 2022
@daeyeon daeyeon deleted the master.doc-220423.Sat.2c15 branch May 25, 2022 03:04
juanarbol pushed a commit that referenced this pull request May 31, 2022
The method might be designed to explicitly take `options`. However,
the implementation and many examples already allow the first parameter
of a function type.

PR-URL: #42832
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
danielleadams pushed a commit that referenced this pull request Jun 27, 2022
The method might be designed to explicitly take `options`. However,
the implementation and many examples already allow the first parameter
of a function type.

PR-URL: #42832
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
targos pushed a commit that referenced this pull request Jul 12, 2022
The method might be designed to explicitly take `options`. However,
the implementation and many examples already allow the first parameter
of a function type.

PR-URL: #42832
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
targos pushed a commit that referenced this pull request Jul 31, 2022
The method might be designed to explicitly take `options`. However,
the implementation and many examples already allow the first parameter
of a function type.

PR-URL: #42832
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
The method might be designed to explicitly take `options`. However,
the implementation and many examples already allow the first parameter
of a function type.

PR-URL: nodejs/node#42832
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. doc Issues and PRs related to the documentations. http2 Issues or PRs related to the http2 subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants