commit
1f5e12a8cf
10 changed files with 27 additions and 14 deletions
|
@ -1,5 +1,9 @@
|
|||
# Change Log
|
||||
|
||||
## 7.0.3
|
||||
|
||||
* Fixed issue #83. Allow Http request to return null headers instead of throwing an exception.
|
||||
|
||||
## 7.0.2
|
||||
|
||||
* Added performance benchmark to README
|
||||
|
|
|
@ -28,8 +28,8 @@ class HttpRequestContext extends RequestContext<HttpRequest?> {
|
|||
}
|
||||
|
||||
@override
|
||||
HttpHeaders get headers {
|
||||
return rawRequest!.headers;
|
||||
HttpHeaders? get headers {
|
||||
return rawRequest?.headers;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: angel3_framework
|
||||
version: 7.0.2
|
||||
version: 7.0.3
|
||||
description: A high-powered HTTP server extensible framework with dependency injection, routing and much more.
|
||||
homepage: https://angel3-framework.web.app/
|
||||
repository: https://github.com/dukefirehawk/angel/tree/master/packages/framework
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
# Change Log
|
||||
|
||||
## 7.0.1
|
||||
|
||||
* Updated `server` header to `angel3`
|
||||
|
||||
## 7.0.0
|
||||
|
||||
* Require Dart >= 2.17
|
||||
|
|
|
@ -93,7 +93,7 @@ class HotReloader {
|
|||
response.statusCode = HttpStatus.badGateway;
|
||||
response.headers
|
||||
..contentType = ContentType.html
|
||||
..set(HttpHeaders.serverHeader, 'angel_hot');
|
||||
..set(HttpHeaders.serverHeader, 'angel3');
|
||||
|
||||
if (request.headers
|
||||
.value(HttpHeaders.acceptEncodingHeader)
|
||||
|
@ -163,11 +163,11 @@ class HotReloader {
|
|||
'You have instantiated a HotReloader without providing any filesystem paths to watch.');
|
||||
}
|
||||
|
||||
bool _sw(String s) {
|
||||
bool sw(String s) {
|
||||
return Platform.executableArguments.any((ss) => ss.startsWith(s));
|
||||
}
|
||||
|
||||
if (!_sw('--observe') && !_sw('--enable-vm-service')) {
|
||||
if (!sw('--observe') && !sw('--enable-vm-service')) {
|
||||
_logWarning(
|
||||
'You have instantiated a HotReloader without passing `--enable-vm-service` or `--observe` to the Dart VM. Hot reloading will be disabled.');
|
||||
isHot = false;
|
||||
|
@ -315,7 +315,7 @@ class HotReloader {
|
|||
}
|
||||
|
||||
Future<void> _listenToStat(String path) async {
|
||||
Future _listen() async {
|
||||
Future listen() async {
|
||||
try {
|
||||
var stat = await FileStat.stat(path);
|
||||
if (stat.type == FileSystemEntityType.link) {
|
||||
|
@ -345,7 +345,7 @@ class HotReloader {
|
|||
}
|
||||
}
|
||||
|
||||
var r = await _listen();
|
||||
var r = await listen();
|
||||
|
||||
if (r == null) {
|
||||
_logWarning(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: angel3_hot
|
||||
version: 7.0.0
|
||||
version: 7.0.1
|
||||
description: Supports hot reloading/hot code push of Angel3 servers on file changes.
|
||||
homepage: https://angel3-framework.web.app/
|
||||
repository: https://github.com/dukefirehawk/angel/tree/master/packages/hot
|
||||
|
|
|
@ -11,7 +11,7 @@ void main(List<String> args) async {
|
|||
var http = AngelHttp(app);
|
||||
var ws = AngelWebSocket(app, sendErrors: !app.environment.isProduction);
|
||||
var fs = const LocalFileSystem();
|
||||
app.logger = Logger('angel_websocket');
|
||||
app.logger = Logger('angel3_websocket');
|
||||
|
||||
// This is a plug-in. It hooks all your services,
|
||||
// to automatically broadcast events.
|
||||
|
@ -25,6 +25,9 @@ void main(List<String> args) async {
|
|||
app.fallback((req, res) => throw AngelHttpException.notFound());
|
||||
|
||||
ws.onConnection.listen((socket) {
|
||||
var h = socket.request.headers;
|
||||
print('WebSocket onConnection $h');
|
||||
|
||||
socket.onData.listen((x) {
|
||||
socket.send('pong', x);
|
||||
});
|
||||
|
|
|
@ -157,7 +157,7 @@ class AngelWebSocket {
|
|||
var event = await transformEvent(e);
|
||||
event.eventName = '$path::${event.eventName}';
|
||||
|
||||
dynamic _filter(WebSocketContext socket) {
|
||||
dynamic filter(WebSocketContext socket) {
|
||||
if (e.service.configuration.containsKey('ws:filter')) {
|
||||
return e.service.configuration['ws:filter'](e, socket);
|
||||
} else if (e.params.containsKey('ws:filter')) {
|
||||
|
@ -167,7 +167,7 @@ class AngelWebSocket {
|
|||
}
|
||||
}
|
||||
|
||||
await batchEvent(event, filter: _filter);
|
||||
await batchEvent(event, filter: filter);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ dev_dependencies:
|
|||
# dependency_overrides:
|
||||
# angel3_container:
|
||||
# path: ../container/angel_container
|
||||
# angel3_framework:
|
||||
# path: ../framework
|
||||
# angel3_framework:
|
||||
# path: ../framework
|
||||
# angel3_http_exception:
|
||||
# path: ../http_exception
|
||||
# angel3_model:
|
||||
|
|
|
@ -26,6 +26,8 @@ void main() {
|
|||
if (username == 'foo' && password == 'bar') {
|
||||
return user;
|
||||
}
|
||||
|
||||
return {};
|
||||
},
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue