Get rid of pedantic stuff
This commit is contained in:
parent
99fbec359e
commit
64d6729def
11 changed files with 58 additions and 51 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
# 2.1.1
|
||||||
|
* `AngelHttp.uri` now returns an empty `Uri` if the server is not listening.
|
||||||
|
|
||||||
# 2.1.0
|
# 2.1.0
|
||||||
* This release was originally planned to be `2.0.5`, but it adds several features, and has
|
* This release was originally planned to be `2.0.5`, but it adds several features, and has
|
||||||
therefore been bumped to `2.1.0`.
|
therefore been bumped to `2.1.0`.
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
include: package:pedantic/analysis_options.yaml
|
# include: package:pedantic/analysis_options.yaml
|
||||||
analyzer:
|
analyzer:
|
||||||
|
errors:
|
||||||
|
always_declare_return_types: ignore
|
||||||
|
omit_local_variable_types: ignore
|
||||||
|
prefer_single_quotes: ignore
|
||||||
|
prefer_spread_collections: ignore
|
||||||
strong-mode:
|
strong-mode:
|
||||||
implicit-casts: false
|
implicit-casts: false
|
||||||
linter:
|
linter:
|
||||||
|
|
|
@ -19,8 +19,9 @@ final RegExp _straySlashes = RegExp(r'(^/+)|(/+$)');
|
||||||
class AngelHttp extends Driver<HttpRequest, HttpResponse, HttpServer,
|
class AngelHttp extends Driver<HttpRequest, HttpResponse, HttpServer,
|
||||||
HttpRequestContext, HttpResponseContext> {
|
HttpRequestContext, HttpResponseContext> {
|
||||||
@override
|
@override
|
||||||
Uri get uri =>
|
Uri get uri => server == null
|
||||||
Uri(scheme: 'http', host: server.address.address, port: server.port);
|
? Uri()
|
||||||
|
: Uri(scheme: 'http', host: server.address.address, port: server.port);
|
||||||
|
|
||||||
AngelHttp._(Angel app,
|
AngelHttp._(Angel app,
|
||||||
Future<HttpServer> Function(dynamic, int) serverGenerator, bool useZone)
|
Future<HttpServer> Function(dynamic, int) serverGenerator, bool useZone)
|
||||||
|
|
|
@ -5,7 +5,6 @@ import 'package:angel_framework/angel_framework.dart' hide Header;
|
||||||
import 'package:angel_framework/http.dart';
|
import 'package:angel_framework/http.dart';
|
||||||
import 'package:http2/transport.dart';
|
import 'package:http2/transport.dart';
|
||||||
import 'package:mock_request/mock_request.dart';
|
import 'package:mock_request/mock_request.dart';
|
||||||
import 'package:pedantic/pedantic.dart';
|
|
||||||
import 'http2_request_context.dart';
|
import 'http2_request_context.dart';
|
||||||
import 'http2_response_context.dart';
|
import 'http2_response_context.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
@ -166,7 +165,7 @@ class _FakeServerSocket extends Stream<Socket> implements ServerSocket {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<ServerSocket> close() async {
|
Future<ServerSocket> close() async {
|
||||||
unawaited(_ctrl.close());
|
(_ctrl.close());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,11 +218,11 @@ class _AngelHttp2ServerSocket extends Stream<SecureSocket>
|
||||||
|
|
||||||
int get port => socket.port;
|
int get port => socket.port;
|
||||||
|
|
||||||
Future<SecureServerSocket> close() async {
|
Future<SecureServerSocket> close() {
|
||||||
unawaited(_sub?.cancel());
|
_sub?.cancel();
|
||||||
unawaited(_fake.close());
|
_fake.close();
|
||||||
unawaited(_ctrl.close());
|
_ctrl.close();
|
||||||
return await socket.close();
|
return socket.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel_framework
|
name: angel_framework
|
||||||
version: 2.1.0
|
version: 2.1.1
|
||||||
description: A high-powered HTTP server with dependency injection, routing and much more.
|
description: A high-powered HTTP server with dependency injection, routing and much more.
|
||||||
author: Tobe O <thosakwe@gmail.com>
|
author: Tobe O <thosakwe@gmail.com>
|
||||||
homepage: https://github.com/angel-dart/angel_framework
|
homepage: https://github.com/angel-dart/angel_framework
|
||||||
|
@ -23,7 +23,7 @@ dependencies:
|
||||||
mime: ^0.9.3
|
mime: ^0.9.3
|
||||||
mock_request: ^1.0.0
|
mock_request: ^1.0.0
|
||||||
path: ^1.0.0
|
path: ^1.0.0
|
||||||
pedantic: ^1.0.0
|
# pedantic: ^1.0.0
|
||||||
quiver_hashcode: ^2.0.0
|
quiver_hashcode: ^2.0.0
|
||||||
recase: ^2.0.0
|
recase: ^2.0.0
|
||||||
stack_trace: ^1.0.0
|
stack_trace: ^1.0.0
|
||||||
|
|
|
@ -3,7 +3,6 @@ import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
import 'package:http2/transport.dart';
|
import 'package:http2/transport.dart';
|
||||||
import 'package:pedantic/pedantic.dart';
|
|
||||||
|
|
||||||
/// Simple HTTP/2 client
|
/// Simple HTTP/2 client
|
||||||
class Http2Client extends BaseClient {
|
class Http2Client extends BaseClient {
|
||||||
|
@ -47,7 +46,7 @@ class Http2Client extends BaseClient {
|
||||||
if (body.isNotEmpty) {
|
if (body.isNotEmpty) {
|
||||||
stream.sendData(body, endStream: true);
|
stream.sendData(body, endStream: true);
|
||||||
} else {
|
} else {
|
||||||
unawaited(stream.outgoingMessages.close());
|
(stream.outgoingMessages.close());
|
||||||
}
|
}
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import 'package:angel_container/mirrors.dart';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel_framework/angel_framework.dart';
|
||||||
import 'package:angel_framework/http.dart';
|
import 'package:angel_framework/http.dart';
|
||||||
import 'package:mock_request/mock_request.dart';
|
import 'package:mock_request/mock_request.dart';
|
||||||
import 'package:pedantic/pedantic.dart';
|
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
Future<String> readResponse(MockHttpResponse rs) {
|
Future<String> readResponse(MockHttpResponse rs) {
|
||||||
|
@ -70,9 +70,9 @@ parameterMetaTests() {
|
||||||
test('injects header or throws', () async {
|
test('injects header or throws', () async {
|
||||||
// Invalid request
|
// Invalid request
|
||||||
var rq = MockHttpRequest('GET', Uri.parse('/header'));
|
var rq = MockHttpRequest('GET', Uri.parse('/header'));
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
var rs = rq.response;
|
var rs = rq.response;
|
||||||
unawaited(http.handleRequest(rq));
|
(http.handleRequest(rq));
|
||||||
|
|
||||||
await printResponse(rs);
|
await printResponse(rs);
|
||||||
expect(rs.statusCode, 400);
|
expect(rs.statusCode, 400);
|
||||||
|
@ -80,9 +80,9 @@ parameterMetaTests() {
|
||||||
// Valid request
|
// Valid request
|
||||||
rq = MockHttpRequest('GET', Uri.parse('/header'))
|
rq = MockHttpRequest('GET', Uri.parse('/header'))
|
||||||
..headers.add('x-foo', 'bar');
|
..headers.add('x-foo', 'bar');
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
rs = rq.response;
|
rs = rq.response;
|
||||||
await unawaited(http.handleRequest(rq));
|
await (http.handleRequest(rq));
|
||||||
|
|
||||||
var body = await readResponse(rs);
|
var body = await readResponse(rs);
|
||||||
print('Body: $body');
|
print('Body: $body');
|
||||||
|
@ -93,9 +93,9 @@ parameterMetaTests() {
|
||||||
test('injects session or throws', () async {
|
test('injects session or throws', () async {
|
||||||
// Invalid request
|
// Invalid request
|
||||||
var rq = MockHttpRequest('GET', Uri.parse('/session'));
|
var rq = MockHttpRequest('GET', Uri.parse('/session'));
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
var rs = rq.response;
|
var rs = rq.response;
|
||||||
unawaited(http
|
(http
|
||||||
.handleRequest(rq)
|
.handleRequest(rq)
|
||||||
.timeout(const Duration(seconds: 5))
|
.timeout(const Duration(seconds: 5))
|
||||||
.catchError((_) => null));
|
.catchError((_) => null));
|
||||||
|
@ -105,9 +105,9 @@ parameterMetaTests() {
|
||||||
|
|
||||||
rq = MockHttpRequest('GET', Uri.parse('/session'));
|
rq = MockHttpRequest('GET', Uri.parse('/session'));
|
||||||
rq.session['foo'] = 'bar';
|
rq.session['foo'] = 'bar';
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
rs = rq.response;
|
rs = rq.response;
|
||||||
unawaited(http.handleRequest(rq));
|
(http.handleRequest(rq));
|
||||||
|
|
||||||
await printResponse(rs);
|
await printResponse(rs);
|
||||||
expect(rs.statusCode, 200);
|
expect(rs.statusCode, 200);
|
||||||
|
@ -119,18 +119,18 @@ parameterMetaTests() {
|
||||||
|
|
||||||
test('pattern matching', () async {
|
test('pattern matching', () async {
|
||||||
var rq = MockHttpRequest('GET', Uri.parse('/match?mode=pos'));
|
var rq = MockHttpRequest('GET', Uri.parse('/match?mode=pos'));
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
var rs = rq.response;
|
var rs = rq.response;
|
||||||
unawaited(http.handleRequest(rq));
|
(http.handleRequest(rq));
|
||||||
var body = await readResponse(rs);
|
var body = await readResponse(rs);
|
||||||
print('Body: $body');
|
print('Body: $body');
|
||||||
expect(rs.statusCode, 200);
|
expect(rs.statusCode, 200);
|
||||||
expect(body, json.encode('YES pos'));
|
expect(body, json.encode('YES pos'));
|
||||||
|
|
||||||
rq = MockHttpRequest('GET', Uri.parse('/match?mode=neg'));
|
rq = MockHttpRequest('GET', Uri.parse('/match?mode=neg'));
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
rs = rq.response;
|
rs = rq.response;
|
||||||
unawaited(http.handleRequest(rq));
|
(http.handleRequest(rq));
|
||||||
body = await readResponse(rs);
|
body = await readResponse(rs);
|
||||||
print('Body: $body');
|
print('Body: $body');
|
||||||
expect(rs.statusCode, 200);
|
expect(rs.statusCode, 200);
|
||||||
|
@ -138,9 +138,9 @@ parameterMetaTests() {
|
||||||
|
|
||||||
// Fallback
|
// Fallback
|
||||||
rq = MockHttpRequest('GET', Uri.parse('/match?mode=ambi'));
|
rq = MockHttpRequest('GET', Uri.parse('/match?mode=ambi'));
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
rs = rq.response;
|
rs = rq.response;
|
||||||
unawaited(http.handleRequest(rq));
|
(http.handleRequest(rq));
|
||||||
body = await readResponse(rs);
|
body = await readResponse(rs);
|
||||||
print('Body: $body');
|
print('Body: $body');
|
||||||
expect(rs.statusCode, 200);
|
expect(rs.statusCode, 200);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import 'package:angel_container/mirrors.dart';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel_framework/angel_framework.dart';
|
||||||
import 'package:angel_framework/http.dart';
|
import 'package:angel_framework/http.dart';
|
||||||
import 'package:mock_request/mock_request.dart';
|
import 'package:mock_request/mock_request.dart';
|
||||||
import 'package:pedantic/pedantic.dart';
|
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
@ -17,7 +17,7 @@ main() {
|
||||||
expect(app.preContained.keys, contains(echoAppFoo));
|
expect(app.preContained.keys, contains(echoAppFoo));
|
||||||
|
|
||||||
var rq = MockHttpRequest('GET', Uri(path: '/foo'));
|
var rq = MockHttpRequest('GET', Uri(path: '/foo'));
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
await AngelHttp(app).handleRequest(rq);
|
await AngelHttp(app).handleRequest(rq);
|
||||||
var rs = rq.response;
|
var rs = rq.response;
|
||||||
var body = await rs.transform(utf8.decoder).join();
|
var body = await rs.transform(utf8.decoder).join();
|
||||||
|
|
|
@ -5,7 +5,7 @@ import 'package:angel_container/mirrors.dart';
|
||||||
import 'package:angel_framework/angel_framework.dart';
|
import 'package:angel_framework/angel_framework.dart';
|
||||||
import 'package:angel_framework/http.dart';
|
import 'package:angel_framework/http.dart';
|
||||||
import 'package:mock_request/mock_request.dart';
|
import 'package:mock_request/mock_request.dart';
|
||||||
import 'package:pedantic/pedantic.dart';
|
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
@ -40,7 +40,7 @@ main() {
|
||||||
|
|
||||||
test('String type annotation', () async {
|
test('String type annotation', () async {
|
||||||
var rq = MockHttpRequest('GET', Uri.parse('/string/hello'));
|
var rq = MockHttpRequest('GET', Uri.parse('/string/hello'));
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
await http.handleRequest(rq);
|
await http.handleRequest(rq);
|
||||||
var rs = await rq.response.transform(utf8.decoder).join();
|
var rs = await rq.response.transform(utf8.decoder).join();
|
||||||
expect(rs, json.encode('hello'));
|
expect(rs, json.encode('hello'));
|
||||||
|
@ -48,7 +48,7 @@ main() {
|
||||||
|
|
||||||
test('Primitive after parsed param injection', () async {
|
test('Primitive after parsed param injection', () async {
|
||||||
var rq = MockHttpRequest('GET', Uri.parse('/num/parsed/24'));
|
var rq = MockHttpRequest('GET', Uri.parse('/num/parsed/24'));
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
await http.handleRequest(rq);
|
await http.handleRequest(rq);
|
||||||
var rs = await rq.response.transform(utf8.decoder).join();
|
var rs = await rq.response.transform(utf8.decoder).join();
|
||||||
expect(rs, json.encode(24));
|
expect(rs, json.encode(24));
|
||||||
|
@ -56,7 +56,7 @@ main() {
|
||||||
|
|
||||||
test('globally-injected primitive', () async {
|
test('globally-injected primitive', () async {
|
||||||
var rq = MockHttpRequest('GET', Uri.parse('/num/global'));
|
var rq = MockHttpRequest('GET', Uri.parse('/num/global'));
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
await http.handleRequest(rq);
|
await http.handleRequest(rq);
|
||||||
var rs = await rq.response.transform(utf8.decoder).join();
|
var rs = await rq.response.transform(utf8.decoder).join();
|
||||||
expect(rs, json.encode(305));
|
expect(rs, json.encode(305));
|
||||||
|
@ -65,7 +65,7 @@ main() {
|
||||||
test('unparsed primitive throws error', () async {
|
test('unparsed primitive throws error', () async {
|
||||||
try {
|
try {
|
||||||
var rq = MockHttpRequest('GET', Uri.parse('/num/unparsed/32'));
|
var rq = MockHttpRequest('GET', Uri.parse('/num/unparsed/32'));
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
var req = await http.createRequestContext(rq, rq.response);
|
var req = await http.createRequestContext(rq, rq.response);
|
||||||
var res = await http.createResponseContext(rq, rq.response, req);
|
var res = await http.createResponseContext(rq, rq.response, req);
|
||||||
await app.runContained((num unparsed) => unparsed, req, res);
|
await app.runContained((num unparsed) => unparsed, req, res);
|
||||||
|
|
|
@ -7,7 +7,7 @@ import 'package:angel_framework/angel_framework.dart';
|
||||||
import 'package:angel_framework/http.dart';
|
import 'package:angel_framework/http.dart';
|
||||||
import 'package:matcher/matcher.dart';
|
import 'package:matcher/matcher.dart';
|
||||||
import 'package:mock_request/mock_request.dart';
|
import 'package:mock_request/mock_request.dart';
|
||||||
import 'package:pedantic/pedantic.dart';
|
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
final Uri $foo = Uri.parse('http://localhost:3000/foo');
|
final Uri $foo = Uri.parse('http://localhost:3000/foo');
|
||||||
|
@ -42,7 +42,7 @@ main() {
|
||||||
var app = Angel(reflector: MirrorsReflector());
|
var app = Angel(reflector: MirrorsReflector());
|
||||||
var http = AngelHttp(app);
|
var http = AngelHttp(app);
|
||||||
var rq = MockHttpRequest('GET', $foo);
|
var rq = MockHttpRequest('GET', $foo);
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
var rs = rq.response;
|
var rs = rq.response;
|
||||||
var req = await http.createRequestContext(rq, rs);
|
var req = await http.createRequestContext(rq, rs);
|
||||||
var res = await http.createResponseContext(rq, rs);
|
var res = await http.createResponseContext(rq, rs);
|
||||||
|
@ -94,7 +94,7 @@ main() {
|
||||||
var http = AngelHttp(app);
|
var http = AngelHttp(app);
|
||||||
app.get('/', ioc((String a) => a));
|
app.get('/', ioc((String a) => a));
|
||||||
var rq = MockHttpRequest('GET', Uri.parse('/'));
|
var rq = MockHttpRequest('GET', Uri.parse('/'));
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
await http.handleRequest(rq);
|
await http.handleRequest(rq);
|
||||||
var body = await rq.response.transform(utf8.decoder).join();
|
var body = await rq.response.transform(utf8.decoder).join();
|
||||||
expect(body, json.encode('b'));
|
expect(body, json.encode('b'));
|
||||||
|
@ -105,7 +105,7 @@ main() {
|
||||||
var http = AngelHttp(app);
|
var http = AngelHttp(app);
|
||||||
app.get($foo.path, (req, ResponseContext res) => res.serialize(null));
|
app.get($foo.path, (req, ResponseContext res) => res.serialize(null));
|
||||||
var rq = MockHttpRequest('GET', $foo);
|
var rq = MockHttpRequest('GET', $foo);
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
await http.handleRequest(rq);
|
await http.handleRequest(rq);
|
||||||
var body = await rq.response.transform(utf8.decoder).join();
|
var body = await rq.response.transform(utf8.decoder).join();
|
||||||
expect(body, 'x');
|
expect(body, 'x');
|
||||||
|
@ -121,7 +121,7 @@ main() {
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
var rq = MockHttpRequest('GET', $foo);
|
var rq = MockHttpRequest('GET', $foo);
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
req = await http.createRequestContext(rq, rq.response);
|
req = await http.createRequestContext(rq, rq.response);
|
||||||
res = await http.createResponseContext(rq, rq.response);
|
res = await http.createResponseContext(rq, rq.response);
|
||||||
});
|
});
|
||||||
|
@ -178,8 +178,8 @@ main() {
|
||||||
test('can send json', () async {
|
test('can send json', () async {
|
||||||
var rq = MockHttpRequest('GET', Uri(path: 'wtf'))
|
var rq = MockHttpRequest('GET', Uri(path: 'wtf'))
|
||||||
..headers.set('accept', 'application/json');
|
..headers.set('accept', 'application/json');
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
unawaited(http.handleRequest(rq));
|
(http.handleRequest(rq));
|
||||||
await rq.response.toList();
|
await rq.response.toList();
|
||||||
expect(rq.response.statusCode, 403);
|
expect(rq.response.statusCode, 403);
|
||||||
expect(rq.response.headers.contentType.mimeType, 'application/json');
|
expect(rq.response.headers.contentType.mimeType, 'application/json');
|
||||||
|
@ -188,8 +188,8 @@ main() {
|
||||||
test('can throw in finalizer', () async {
|
test('can throw in finalizer', () async {
|
||||||
var rq = MockHttpRequest('GET', Uri(path: 'wtf'))
|
var rq = MockHttpRequest('GET', Uri(path: 'wtf'))
|
||||||
..headers.set('accept', 'application/json');
|
..headers.set('accept', 'application/json');
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
unawaited(http.handleRequest(rq));
|
(http.handleRequest(rq));
|
||||||
await rq.response.toList();
|
await rq.response.toList();
|
||||||
expect(rq.response.statusCode, 403);
|
expect(rq.response.statusCode, 403);
|
||||||
expect(rq.response.headers.contentType.mimeType, 'application/json');
|
expect(rq.response.headers.contentType.mimeType, 'application/json');
|
||||||
|
@ -198,8 +198,8 @@ main() {
|
||||||
test('can send html', () async {
|
test('can send html', () async {
|
||||||
var rq = MockHttpRequest('GET', Uri(path: 'wtf2'));
|
var rq = MockHttpRequest('GET', Uri(path: 'wtf2'));
|
||||||
rq.headers.set('accept', 'text/html');
|
rq.headers.set('accept', 'text/html');
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
unawaited(http.handleRequest(rq));
|
(http.handleRequest(rq));
|
||||||
await rq.response.toList();
|
await rq.response.toList();
|
||||||
expect(rq.response.statusCode, 403);
|
expect(rq.response.statusCode, 403);
|
||||||
expect(rq.response.headers.contentType?.mimeType, 'text/html');
|
expect(rq.response.headers.contentType?.mimeType, 'text/html');
|
||||||
|
|
|
@ -8,7 +8,7 @@ import 'package:angel_framework/angel_framework.dart';
|
||||||
import 'package:angel_framework/http.dart';
|
import 'package:angel_framework/http.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:mock_request/mock_request.dart';
|
import 'package:mock_request/mock_request.dart';
|
||||||
import 'package:pedantic/pedantic.dart';
|
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
import 'encoders_buffer_test.dart' show encodingTests;
|
import 'encoders_buffer_test.dart' show encodingTests;
|
||||||
|
@ -77,7 +77,7 @@ main() {
|
||||||
|
|
||||||
_expectHelloBye(String path) async {
|
_expectHelloBye(String path) async {
|
||||||
var rq = MockHttpRequest('GET', Uri.parse(path));
|
var rq = MockHttpRequest('GET', Uri.parse(path));
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
await http.handleRequest(rq);
|
await http.handleRequest(rq);
|
||||||
var body = await rq.response.transform(utf8.decoder).join();
|
var body = await rq.response.transform(utf8.decoder).join();
|
||||||
expect(body, 'Hello, world!bye');
|
expect(body, 'Hello, world!bye');
|
||||||
|
@ -90,7 +90,7 @@ main() {
|
||||||
test('cannot write after close', () async {
|
test('cannot write after close', () async {
|
||||||
try {
|
try {
|
||||||
var rq = MockHttpRequest('GET', Uri.parse('/overwrite'));
|
var rq = MockHttpRequest('GET', Uri.parse('/overwrite'));
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
await http.handleRequest(rq);
|
await http.handleRequest(rq);
|
||||||
var body = await rq.response.transform(utf8.decoder).join();
|
var body = await rq.response.transform(utf8.decoder).join();
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ main() {
|
||||||
test('res => addError', () async {
|
test('res => addError', () async {
|
||||||
try {
|
try {
|
||||||
var rq = MockHttpRequest('GET', Uri.parse('/error'));
|
var rq = MockHttpRequest('GET', Uri.parse('/error'));
|
||||||
unawaited(rq.close());
|
(rq.close());
|
||||||
await http.handleRequest(rq);
|
await http.handleRequest(rq);
|
||||||
var body = await rq.response.transform(utf8.decoder).join();
|
var body = await rq.response.transform(utf8.decoder).join();
|
||||||
throw 'addError should throw error; response: $body';
|
throw 'addError should throw error; response: $body';
|
||||||
|
|
Loading…
Reference in a new issue