提交 53c245bf 编写于 作者: T Tim Neutkens 提交者: Arunoda Susiripala

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
上级 bdcb0f78
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册