Skip to content

Commit 53c245b

Browse files
timneutkensarunoda
authored andcommitted
Throw when parsedUrl is not provided (#1015)
* Throw when parsedUrl is not provided * Allow parsedUrl to be empty * Remove unwanted line. * Reset to the original
1 parent bdcb0f7 commit 53c245b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ export default class Server {
3434

3535
getRequestHandler () {
3636
return (req, res, parsedUrl) => {
37-
if (!parsedUrl || parsedUrl.query === null) {
37+
if (!parsedUrl) {
3838
parsedUrl = parse(req.url, true)
3939
}
4040

41+
if (!parsedUrl.query) {
42+
throw new Error('Please provide a parsed url to `handle` as third parameter. See https://github.com/zeit/next.js#custom-server-and-routing for an example.')
43+
}
44+
4145
this.run(req, res, parsedUrl)
4246
.catch((err) => {
4347
if (!this.quiet) console.error(err)

0 commit comments

Comments
 (0)