Hm
This commit is contained in:
parent
ddae8d9cf1
commit
4d4422d31f
2 changed files with 4 additions and 0 deletions
|
@ -2,6 +2,7 @@ import 'dart:async';
|
|||
import 'dart:io';
|
||||
import 'package:angel_framework/angel_framework.dart';
|
||||
import 'package:angel_route/angel_route.dart';
|
||||
import 'package:mime/mime.dart';
|
||||
|
||||
typedef StaticFileCallback(File file, RequestContext req, ResponseContext res);
|
||||
|
||||
|
@ -60,6 +61,7 @@ class VirtualDirectory {
|
|||
Future<bool> sendFile(
|
||||
File file, RequestContext req, ResponseContext res) async {
|
||||
_printDebug('Sending file ${file.absolute.path}...');
|
||||
_printDebug('MIME type for ${file.path}: ${lookupMimeType(file.path)}');
|
||||
res.statusCode = 200;
|
||||
|
||||
if (callback != null) {
|
||||
|
@ -68,6 +70,7 @@ class VirtualDirectory {
|
|||
if (r != null && r != true) return r;
|
||||
}
|
||||
|
||||
res.headers[HttpHeaders.CONTENT_TYPE] = lookupMimeType(file.path);
|
||||
await res.streamFile(file);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ author: thosakwe <thosakwe@gmail.com>
|
|||
version: 1.1.1
|
||||
dependencies:
|
||||
angel_framework: ^1.0.0-dev
|
||||
mime: ^0.9.3
|
||||
dev_dependencies:
|
||||
http: ^0.11.3
|
||||
test: ^0.12.13
|
||||
|
|
Loading…
Reference in a new issue