Skip to content

Add X-Powered-By header. #416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 19, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import read from './read'
import Router from '../lib/router'
import Head, { defaultHead } from '../lib/head'
import App from '../lib/app'
// We need to go up one more level since we are in the `dist` directory
import pkg from '../../package'

export async function render (req, res, pathname, query, opts) {
const html = await renderToHTML(req, res, pathname, opts)
Expand Down Expand Up @@ -102,6 +104,7 @@ export async function renderErrorJSON (err, res, { dir = process.cwd(), dev = fa
export function sendHTML (res, html) {
res.setHeader('Content-Type', 'text/html')
res.setHeader('Content-Length', Buffer.byteLength(html))
res.setHeader('X-Powered-By', `Next.js ${pkg.version}`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use pkg.name to DRY

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it only says next. Not Next.js.

res.end(html)
}

Expand Down