Updated Hot

This commit is contained in:
thomashii@dukefirehawk.com 2023-11-13 10:08:33 +08:00
parent 52c36cdcc2
commit cf11cc2d3c
3 changed files with 29 additions and 2 deletions

View file

@ -3,7 +3,7 @@
## 8.1.0
* Updated `vm_service` to 13.0.0
* Added configurable HTTP response header
* Updated README
## 8.0.0

View file

@ -77,3 +77,30 @@ Future<Angel> createServer() async {
return app;
}
```
## Customising Response Header
The following code snippet removes `X-FRAME-OPTIONS` and adds `X-XSRF-TOKEN` to the response header.
```dart
import 'dart:io';
import 'package:angel3_hot/angel3_hot.dart';
import 'server.dart';
void main() async {
var hot = HotReloader(createServer, [
Directory('src'),
'server.dart',
// Also allowed: Platform.script,
Uri.parse('package:angel3_hot/angel3_hot.dart')
]);
var http = await hot.startServer('127.0.0.1', 3000);
// Remove 'X-FRAME-OPTIONS'
http.defaultResponseHeaders.remove('X-FRAME-OPTIONS', 'SAMEORIGIN');
// Add 'X-XSRF_TOKEN'
http.defaultResponseHeaders.add('X-XSRF-TOKEN',
'a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e');
}
```

View file

@ -6,7 +6,7 @@ repository: https://github.com/dukefirehawk/angel/tree/master/packages/hot
environment:
sdk: '>=3.0.0 <4.0.0'
dependencies:
angel3_framework: ^8.0.0
angel3_framework: ^8.2.0
angel3_websocket: ^8.0.0
belatuk_html_builder: ^5.0.0
charcode: ^1.3.0