Unverified Commit d373b893 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Don’t finish request when it’s already finished (#3660)

parent abe6e3ea
...@@ -18,6 +18,7 @@ import getConfig from './config' ...@@ -18,6 +18,7 @@ import getConfig from './config'
// We need to go up one more level since we are in the `dist` directory // We need to go up one more level since we are in the `dist` directory
import pkg from '../../package' import pkg from '../../package'
import * as asset from '../lib/asset' import * as asset from '../lib/asset'
import { isResSent } from '../lib/utils'
const blockedPages = { const blockedPages = {
'/_document': true, '/_document': true,
...@@ -309,6 +310,10 @@ export default class Server { ...@@ -309,6 +310,10 @@ export default class Server {
} }
const html = await this.renderToHTML(req, res, pathname, query) const html = await this.renderToHTML(req, res, pathname, query)
if (isResSent(res)) {
return
}
res.setHeader('X-Powered-By', `Next.js ${pkg.version}`) res.setHeader('X-Powered-By', `Next.js ${pkg.version}`)
return sendHTML(req, res, html, req.method, this.renderOpts) return sendHTML(req, res, html, req.method, this.renderOpts)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment