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