Skip to content
Permalink
Browse files
Add additional file serving tests (#12479)
* Test `static/` file name encoding

* Fix `static/` file name encoding

* Add additional file-serving tests

* bump

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
  • Loading branch information
ijjk and Timer committed May 4, 2020
1 parent 3af0fe5 commit 00d930aae82e59dd2d4facd25af249c31c9933c5
@@ -272,9 +272,21 @@ export default class DevServer extends Server {
}

protected async hasPage(pathname: string): Promise<boolean> {
let normalizedPath: string

try {
normalizedPath = normalizePagePath(pathname)
} catch (err) {
console.error(err)
// if normalizing the page fails it means it isn't valid
// so it doesn't exist so don't throw and return false
// to ensure we return 404 instead of 500
return false
}

const pageFile = await findPageFile(
this.pagesDir!,
normalizePagePath(pathname),
normalizedPath,
this.nextConfig.pageExtensions
)
return !!pageFile
@@ -0,0 +1 @@
this is used for traverse testing
@@ -0,0 +1 @@
export default () => 'hi'
@@ -0,0 +1 @@
hi
@@ -0,0 +1 @@
hi
@@ -0,0 +1 @@
this is used for traverse testing

0 comments on commit 00d930a

Please sign in to comment.