Skip to content

Commit

Permalink
http2: rename function for clarity
Browse files Browse the repository at this point in the history
The function does not only validate the input but it causes side
effects by adding default options to the input object in case the
option is not set.

PR-URL: #26809
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
BridgeAR committed Mar 27, 2019
1 parent bbfa93a commit 92db780
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ function requestOnConnect(headers, options) {
// 4. if specified, options.silent must be a boolean
//
// Also sets the default priority options if they are not set.
const validatePriorityOptions = hideStackFrames((options) => {
const setAndValidatePriorityOptions = hideStackFrames((options) => {
if (options.weight === undefined) {
options.weight = NGHTTP2_DEFAULT_WEIGHT;
} else if (typeof options.weight !== 'number') {
Expand Down Expand Up @@ -1451,7 +1451,7 @@ class ClientHttp2Session extends Http2Session {
throw new ERR_HTTP2_CONNECT_PATH();
}

validatePriorityOptions(options);
setAndValidatePriorityOptions(options);

if (options.endStream === undefined) {
// For some methods, we know that a payload is meaningless, so end the
Expand Down Expand Up @@ -1839,7 +1839,7 @@ class Http2Stream extends Duplex {

assertIsObject(options, 'options');
options = { ...options };
validatePriorityOptions(options);
setAndValidatePriorityOptions(options);

const priorityFn = submitPriority.bind(this, options);

Expand Down

0 comments on commit 92db780

Please sign in to comment.