summaryrefslogtreecommitdiff
path: root/lib/internal/http2/core.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/internal/http2/core.js')
-rw-r--r--lib/internal/http2/core.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js
index d2701dfb84..11d677c5f6 100644
--- a/lib/internal/http2/core.js
+++ b/lib/internal/http2/core.js
@@ -82,6 +82,7 @@ const {
hideStackFrames
} = require('internal/errors');
const { validateNumber, validateString } = require('internal/validators');
+const fsPromisesInternal = require('internal/fs/promises');
const { utcDate } = require('internal/http');
const { onServerStream,
Http2ServerRequest,
@@ -2523,7 +2524,10 @@ class ServerHttp2Stream extends Http2Stream {
this[kState].flags |= STREAM_FLAGS_HAS_TRAILERS;
}
- validateNumber(fd, 'fd');
+ if (fd instanceof fsPromisesInternal.FileHandle)
+ fd = fd.fd;
+ else if (typeof fd !== 'number')
+ throw new ERR_INVALID_ARG_TYPE('fd', ['number', 'FileHandle'], fd);
debugStreamObj(this, 'initiating response from fd');
this[kUpdateTimer]();