From 0ab637eb15086b7a4c12cd902e7c448c9124a85a Mon Sep 17 00:00:00 2001 From: thosakwe Date: Wed, 21 Dec 2016 12:51:43 -0500 Subject: [PATCH] :) --- README.md | 4 ++-- lib/src/virtual_directory.dart | 7 +------ pubspec.yaml | 11 ++++++----- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 4ea17e81..a6c58cac 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # angel_static -![version 1.1.0-dev](https://img.shields.io/badge/version-1.1.0--dev-red.svg) +![version 1.1.0-dev+2](https://img.shields.io/badge/version-1.1.0--dev+2-red.svg) ![build status](https://travis-ci.org/angel-dart/static.svg?branch=master) Static server middleware for Angel. @@ -11,7 +11,7 @@ In `pubspec.yaml`: ```yaml dependencies: angel_framework: ^1.0.0-dev - angel_static: ^1.1.0-dev+1 + angel_static: ^1.1.0-dev ``` # Usage diff --git a/lib/src/virtual_directory.dart b/lib/src/virtual_directory.dart index ceb724fe..461d5c99 100644 --- a/lib/src/virtual_directory.dart +++ b/lib/src/virtual_directory.dart @@ -2,7 +2,6 @@ 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' show lookupMimeType; final RegExp _param = new RegExp(r':([A-Za-z0-9_]+)(\((.+)\))?'); final RegExp _straySlashes = new RegExp(r'(^/+)|(/+$)'); @@ -56,12 +55,8 @@ class VirtualDirectory { Future sendFile(File file, ResponseContext res) async { _printDebug('Streaming file ${file.absolute.path}...'); - res - ..willCloseItself = true - ..header(HttpHeaders.CONTENT_TYPE, lookupMimeType(file.path)) - ..status(200); + res.statusCode = 200; await res.streamFile(file); - await res.io.close(); return false; } diff --git a/pubspec.yaml b/pubspec.yaml index d564240e..8db7412e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,12 @@ name: angel_static description: Static server middleware for Angel. +environment: + sdk: ">=1.19.0" homepage: https://github.com/angel-dart/angel_static author: thosakwe -version: 1.1.0-dev+1 +version: 1.1.0-dev+2 dependencies: - angel_framework: ">=1.0.0-dev < 2.0.0" - mime: ">= 0.9.3 < 0.10.0" + angel_framework: ^1.0.0-dev dev_dependencies: - http: ">= 0.11.3 < 0.12.0" - test: ">= 0.12.13 < 0.13.0" + http: ^0.11.3 + test: ^0.12.13