2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
- // @dart = 2.9
6
-
7
5
import 'dart:io' ;
8
6
9
7
import 'package:dwds/src/handlers/injector.dart' ;
@@ -16,13 +14,13 @@ import 'package:test/test.dart';
16
14
import '../fixtures/fakes.dart' ;
17
15
18
16
void main () {
19
- HttpServer server;
17
+ late HttpServer server;
20
18
const entryEtag = 'entry etag' ;
21
19
const nonEntryEtag = 'some etag' ;
22
20
final loadStrategy = FakeStrategy ();
23
21
24
22
group ('InjectedHandlerWithoutExtension' , () {
25
- DwdsInjector injector;
23
+ late DwdsInjector injector;
26
24
setUp (() async {
27
25
injector = DwdsInjector (loadStrategy);
28
26
final pipeline = const Pipeline ().addMiddleware (injector.middleware);
@@ -117,13 +115,13 @@ void main() {
117
115
() async {
118
116
final originalResponse = await http.get (Uri .parse (
119
117
'http://localhost:${server .port }/entrypoint$bootstrapJsExtension ' ));
118
+
119
+ final etagHeader = originalResponse.headers[HttpHeaders .etagHeader];
120
+ expect (etagHeader, isNotNull);
120
121
final cachedResponse = await http.get (
121
122
Uri .parse (
122
123
'http://localhost:${server .port }/entrypoint$bootstrapJsExtension ' ),
123
- headers: {
124
- HttpHeaders .ifNoneMatchHeader:
125
- originalResponse.headers[HttpHeaders .etagHeader]
126
- });
124
+ headers: {HttpHeaders .ifNoneMatchHeader: etagHeader! });
127
125
expect (cachedResponse.statusCode, HttpStatus .notModified);
128
126
});
129
127
@@ -209,7 +207,7 @@ void main() {
209
207
});
210
208
211
209
group ('InjectedHandlerWithoutExtension using WebSockets' , () {
212
- DwdsInjector injector;
210
+ late DwdsInjector injector;
213
211
setUp (() async {
214
212
injector = DwdsInjector (loadStrategy, useSseForInjectedClient: false );
215
213
final pipeline = const Pipeline ().addMiddleware (injector.middleware);
0 commit comments