1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

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
This commit is contained in:
Tim Neutkens 2017-02-09 04:22:48 +01:00 committed by Arunoda Susiripala
parent bdcb0f7828
commit 53c245bf63

View file

@ -34,10 +34,14 @@ export default class Server {
getRequestHandler () {
return (req, res, parsedUrl) => {
if (!parsedUrl || parsedUrl.query === null) {
if (!parsedUrl) {
parsedUrl = parse(req.url, true)
}
if (!parsedUrl.query) {
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.')
}
this.run(req, res, parsedUrl)
.catch((err) => {
if (!this.quiet) console.error(err)