Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions dwds/test/handlers/injector_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// @dart = 2.9

import 'dart:io';

import 'package:dwds/src/handlers/injector.dart';
Expand All @@ -16,13 +14,13 @@ import 'package:test/test.dart';
import '../fixtures/fakes.dart';

void main() {
HttpServer server;
late HttpServer server;
const entryEtag = 'entry etag';
const nonEntryEtag = 'some etag';
final loadStrategy = FakeStrategy();

group('InjectedHandlerWithoutExtension', () {
DwdsInjector injector;
late DwdsInjector injector;
setUp(() async {
injector = DwdsInjector(loadStrategy);
final pipeline = const Pipeline().addMiddleware(injector.middleware);
Expand Down Expand Up @@ -117,13 +115,13 @@ void main() {
() async {
final originalResponse = await http.get(Uri.parse(
'http://localhost:${server.port}/entrypoint$bootstrapJsExtension'));

final etagHeader = originalResponse.headers[HttpHeaders.etagHeader];
expect(etagHeader, isNotNull);
final cachedResponse = await http.get(
Uri.parse(
'http://localhost:${server.port}/entrypoint$bootstrapJsExtension'),
headers: {
HttpHeaders.ifNoneMatchHeader:
originalResponse.headers[HttpHeaders.etagHeader]
});
headers: {HttpHeaders.ifNoneMatchHeader: etagHeader!});
expect(cachedResponse.statusCode, HttpStatus.notModified);
});

Expand Down Expand Up @@ -209,7 +207,7 @@ void main() {
});

group('InjectedHandlerWithoutExtension using WebSockets', () {
DwdsInjector injector;
late DwdsInjector injector;
setUp(() async {
injector = DwdsInjector(loadStrategy, useSseForInjectedClient: false);
final pipeline = const Pipeline().addMiddleware(injector.middleware);
Expand Down