-
Notifications
You must be signed in to change notification settings - Fork 245
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
no file extension, application/octet-stream #169
Comments
Could also switch away from "mime" package to https://github.com/Hypercubed/mime-lookup |
Hello? |
Forget it. Switching to st fixed this issue. |
I had the same issue, and solved it by: var SERVER_PATH = './dist';
var SERVER_PORT = 8080;
function runServer() {
var file = new static.Server(SERVER_PATH);
require('http').createServer(function (request, response) {
request.addListener('end', function () {
// check if last part of address has extension, if not serve html
if (request.url.split('/').pop().indexOf('.') === -1) {
file.serveFile(request.url, 200, {'Content-Type': 'text/html'}, request, response);
} else {
file.serve(request, response);
}
}).resume();
}).listen(SERVER_PORT);
} |
@cloudhead, |
Everything that this library does, |
PR #184 would allow something like this: var file = new static.Server('./public');
require('http').createServer(function (request, response) {
request.addListener('end', function () {
response.setHeader('Content-Type', 'text/html') // explicitly override header here
file.serve(request, response);
}).resume();
}).listen(8080); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Files with no extension are served with content-type
"application/octet-stream"
due to https://www.npmjs.com/package/mime#mime-default-typeShouldn't they just be
undefined
?:The text was updated successfully, but these errors were encountered: