@@ -15,15 +15,14 @@ const { cwd } = process;
15
15
const console = require ( 'internal/console/global' ) ;
16
16
const { createReadStream } = require ( 'fs' ) ;
17
17
const { Server } = require ( '_http_server' ) ;
18
- const { URL , formatSymbol , isURLInstance , pathToFileURL } = require ( 'internal/url' ) ;
18
+ const { URL , isURL , pathToFileURL } = require ( 'internal/url' ) ;
19
19
const { emitExperimentalWarning, kEmptyObject } = require ( 'internal/util' ) ;
20
20
const { validateFunction, validatePort } = require ( 'internal/validators' ) ;
21
21
22
22
const dot = / \/ ( \. | % 2 [ e E ] ) / ;
23
23
function filterDotFiles ( url , fileURL ) {
24
24
return RegExpPrototypeExec ( dot , fileURL . pathname ) === null ;
25
25
}
26
- const urlFormatOptions = { auth : false , search : false , fragment : false } ;
27
26
28
27
function createStaticServer ( options = kEmptyObject ) {
29
28
emitExperimentalWarning ( 'http/static' ) ;
@@ -37,7 +36,7 @@ function createStaticServer(options = kEmptyObject) {
37
36
log = console . log ,
38
37
onStart = ( host , port ) => console . log ( `Server started on http://${ host } :${ port } ` ) ,
39
38
} = options ;
40
- const directoryURL = isURLInstance ( directory ) ? directory : pathToFileURL ( directory ) ;
39
+ const directoryURL = isURL ( directory ) ? directory : pathToFileURL ( directory ) ;
41
40
// To be used as a base URL, it is necessary that the URL ends with a slash:
42
41
const baseDirectoryURL = StringPrototypeEndsWith ( directoryURL . pathname , '/' ) ?
43
42
directoryURL : new URL ( `${ directoryURL } /` ) ;
@@ -49,7 +48,7 @@ function createStaticServer(options = kEmptyObject) {
49
48
const url = new URL (
50
49
req . url === '/' || StringPrototypeStartsWith ( req . url , '/?' ) ?
51
50
'./index.html' :
52
- '.' + StringPrototypeSlice ( new URL ( req . url , 'root://' ) [ formatSymbol ] ( urlFormatOptions ) , 6 ) ,
51
+ '.' + StringPrototypeSlice ( ` ${ new URL ( req . url , 'root://' ) } ` , 6 ) ,
53
52
baseDirectoryURL ,
54
53
) ;
55
54
0 commit comments