Skip to content

Commit

Permalink
fix: improve URL handling where req.url is undefined or empty
Browse files Browse the repository at this point in the history
  • Loading branch information
bent10 committed Apr 25, 2024
1 parent 3a5ef0a commit 0bd8def
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/vite/src/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ export default function serve(): Plugin {
}

if (req.headers['sec-fetch-dest'] === 'document') {
let route = api.getRoute(server.config.base + req.url?.slice(1))
let route = api.getRoute(
server.config.base +
(req.url?.slice(1) || `index${api.routesConfig.urlSuffix}`)
)
let statusCode = 200

// @todo add option to handle error 404
Expand Down

0 comments on commit 0bd8def

Please # to comment.