patch index.html
parent
e2db34a6b2
commit
45e2f4c9d9
5
index.js
5
index.js
|
@ -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('')
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue