patch index.html

master
宇天 2022-04-26 01:55:30 +08:00
parent e2db34a6b2
commit 45e2f4c9d9
2 changed files with 3 additions and 4 deletions

View File

@ -68,9 +68,7 @@ function createServer() {
std.out(`尝试使用${port}端口...`)
http
.createServer(function (req, res) {
let pathname = parse(req.url)
.pathname.slice(1)
.replace(/[\/]+$/, '')
let pathname = parse(req.url).pathname.slice(1)
pathname = decode(pathname) || 'index.html'
@ -95,6 +93,7 @@ function createServer() {
} else {
res.setHeader('content-type', MIME_TYPES.html)
res.setHeader('content-length', 0)
res.setHeader('x-url', file)
res.writeHead(404, 'Not Found')
res.end('')
}

View File

@ -2,7 +2,7 @@
"name": "simple-http",
"displayName": "simple http",
"description": "🔥 简单的http服务器, 方便临时调试html",
"version": "1.2.2",
"version": "1.2.3",
"publisher": "yutent",
"author": "Yutent [@yutent]",
"icon": "logo.png",