Skip to content

Commit a5ea0d7

Browse files
committed
fix failing test
1 parent 29257f9 commit a5ea0d7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/internal/http/static.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ const { cwd } = process;
1515
const console = require('internal/console/global');
1616
const { createReadStream } = require('fs');
1717
const { Server } = require('_http_server');
18-
const { URL, formatSymbol, isURLInstance, pathToFileURL } = require('internal/url');
18+
const { URL, isURL, pathToFileURL } = require('internal/url');
1919
const { emitExperimentalWarning, kEmptyObject } = require('internal/util');
2020
const { validateFunction, validatePort } = require('internal/validators');
2121

2222
const dot = /\/(\.|%2[eE])/;
2323
function filterDotFiles(url, fileURL) {
2424
return RegExpPrototypeExec(dot, fileURL.pathname) === null;
2525
}
26-
const urlFormatOptions = { auth: false, search: false, fragment: false };
2726

2827
function createStaticServer(options = kEmptyObject) {
2928
emitExperimentalWarning('http/static');
@@ -37,7 +36,7 @@ function createStaticServer(options = kEmptyObject) {
3736
log = console.log,
3837
onStart = (host, port) => console.log(`Server started on http://${host}:${port}`),
3938
} = options;
40-
const directoryURL = isURLInstance(directory) ? directory : pathToFileURL(directory);
39+
const directoryURL = isURL(directory) ? directory : pathToFileURL(directory);
4140
// To be used as a base URL, it is necessary that the URL ends with a slash:
4241
const baseDirectoryURL = StringPrototypeEndsWith(directoryURL.pathname, '/') ?
4342
directoryURL : new URL(`${directoryURL}/`);
@@ -49,7 +48,7 @@ function createStaticServer(options = kEmptyObject) {
4948
const url = new URL(
5049
req.url === '/' || StringPrototypeStartsWith(req.url, '/?') ?
5150
'./index.html' :
52-
'.' + StringPrototypeSlice(new URL(req.url, 'root://')[formatSymbol](urlFormatOptions), 6),
51+
'.' + StringPrototypeSlice(`${new URL(req.url, 'root://')}`, 6),
5352
baseDirectoryURL,
5453
);
5554

0 commit comments

Comments
 (0)