2.0.0-rc.5
This commit is contained in:
parent
d834fda6cb
commit
ef8e343ccd
5 changed files with 18 additions and 8 deletions
|
@ -1,3 +1,7 @@
|
|||
# 2.0.0-rc.5
|
||||
* Make `serializer` `FutureOr<String> Function(Object)`.
|
||||
* Make `ResponseContext.serialize` return `Future<bool>`.
|
||||
|
||||
# 2.0.0-rc.4
|
||||
* Support resolution of asynchronous injections in controllers and `ioc`.
|
||||
* Inject `RequestContext` and `ResponseContext` into requests.
|
||||
|
|
|
@ -71,7 +71,7 @@ abstract class ResponseContext<RawResponse>
|
|||
/// ```dart
|
||||
/// app.injectSerializer(JSON.encode);
|
||||
/// ```
|
||||
String Function(dynamic) serializer = c.json.encode;
|
||||
FutureOr<String> Function(dynamic) serializer = c.json.encode;
|
||||
|
||||
/// This response's status code.
|
||||
int get statusCode => _statusCode;
|
||||
|
@ -295,13 +295,13 @@ abstract class ResponseContext<RawResponse>
|
|||
}
|
||||
|
||||
/// Serializes data to the response.
|
||||
bool serialize(value, {MediaType contentType}) {
|
||||
Future<bool> serialize(value, {MediaType contentType}) async {
|
||||
if (!isOpen) throw closed();
|
||||
this.contentType = contentType ?? new MediaType('application', 'json');
|
||||
var text = serializer(value);
|
||||
var text = await serializer(value);
|
||||
if (text.isEmpty) return true;
|
||||
write(text);
|
||||
close();
|
||||
await close();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class Angel extends Routable {
|
|||
final MimeTypeResolver mimeTypeResolver = new MimeTypeResolver();
|
||||
|
||||
/// A middleware to inject a serialize on every request.
|
||||
String Function(dynamic) serializer;
|
||||
FutureOr<String> Function(dynamic) serializer;
|
||||
|
||||
/// A [Map] of dependency data obtained via reflection.
|
||||
///
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: angel_framework
|
||||
version: 2.0.0-rc.4
|
||||
version: 2.0.0-rc.5
|
||||
description: A high-powered HTTP server with dependency injection, routing and much more.
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/angel_framework
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:io/ansi.dart';
|
||||
|
||||
import 'accepts_test.dart' as accepts;
|
||||
import 'anonymous_service_test.dart' as anonymous_service;
|
||||
import 'body_test.dart' as body;
|
||||
import 'controller_test.dart' as controller;
|
||||
import 'detach_test.dart' as detach;
|
||||
import 'di_test.dart' as di;
|
||||
import 'encoders_buffer_test.dart' as encoders_buffer;
|
||||
import 'env_test.dart' as env;
|
||||
import 'exception_test.dart' as exception;
|
||||
import 'extension_test.dart' as extension;
|
||||
import 'find_one_test.dart' as find_one;
|
||||
import 'general_test.dart' as general;
|
||||
import 'hooked_test.dart' as hooked;
|
||||
import 'parameter_meta_test.dart' as parameter_meta;
|
||||
import 'parse_id_test.dart' as parse_id;
|
||||
import 'precontained_test.dart' as precontained;
|
||||
import 'primitives_test.dart' as primitives;
|
||||
import 'repeat_request_test.dart' as repeat_request;
|
||||
|
@ -30,15 +32,19 @@ main() {
|
|||
print(cyan.wrap('Running tests on ${Platform.version}'));
|
||||
group('accepts', accepts.main);
|
||||
group('anonymous service', anonymous_service.main);
|
||||
group('body', body.main);
|
||||
group('controller', controller.main);
|
||||
group('detach', detach.main);
|
||||
group('di', di.main);
|
||||
group('encoders_buffer', encoders_buffer.main);
|
||||
group('env', env.main);
|
||||
group('exception', exception.main);
|
||||
group('extension', extension.main);
|
||||
group('find_one', find_one.main);
|
||||
group('general', general.main);
|
||||
group('hooked', hooked.main);
|
||||
group('parameter_meta', parameter_meta.main);
|
||||
group('parse_id', parse_id.main);
|
||||
group('precontained', precontained.main);
|
||||
group('primitives', primitives.main);
|
||||
group('repeat request', repeat_request.main);
|
||||
|
|
Loading…
Reference in a new issue