Skip to content
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

Remove charset=utf-8 default #223

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ecstatic.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ module.exports = function createMiddleware(_dir, _options) {
let stream = null;

if (contentType) {
charSet = mime.charsets.lookup(contentType, 'utf-8');
charSet = mime.charsets.lookup(contentType);
if (charSet) {
contentType += `; charset=${charSet}`;
}
Expand Down
2 changes: 1 addition & 1 deletion test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ test('setting mimeTypes via cli - directly', (t) => {
t.pass('ecstatic should be started');
checkServerIsRunning(`${defaultUrl}:${port}/custom_mime_type.opml`, t, (err, res) => {
t.error(err);
t.equal(res.headers['content-type'], 'application/x-my-type; charset=utf-8');
t.equal(res.headers['content-type'], 'application/x-my-type');
});
});
});
2 changes: 1 addition & 1 deletion test/custom-content-type-file-secret.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test('custom contentType via .types file', (t) => {
request.get(`http://localhost:${port}/custom_mime_type.opml`, (err, res) => {
t.ifError(err);
t.equal(res.statusCode, 200, 'custom_mime_type.opml should be found');
t.equal(res.headers['content-type'], 'application/secret; charset=utf-8');
t.equal(res.headers['content-type'], 'application/secret');
server.close(() => { t.end(); });
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/custom-content-type-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test('custom contentType via .types file', (t) => {
request.get(`http://localhost:${port}/custom_mime_type.opml`, (err, res) => {
t.ifError(err);
t.equal(res.statusCode, 200, 'custom_mime_type.opml should be found');
t.equal(res.headers['content-type'], 'application/foo; charset=utf-8');
t.equal(res.headers['content-type'], 'application/foo');
server.close(() => { t.end(); });
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/custom-content-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test('custom contentType', (t) => {
request.get(`http://localhost:${port}/custom_mime_type.opml`, (err, res) => {
t.ifError(err);
t.equal(res.statusCode, 200, 'custom_mime_type.opml should be found');
t.equal(res.headers['content-type'], 'application/jon; charset=utf-8');
t.equal(res.headers['content-type'], 'application/jon');
server.close(() => { t.end(); });
});
});
Expand Down