From d3a3d937961889339c5531ca664bf4c4c8cb0577 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sun, 19 Aug 2018 23:40:59 -0400 Subject: [PATCH] Rename HTTP request+response impl, drop the "impl" --- CHANGELOG.md | 4 +++- lib/src/http/angel_http.dart | 8 ++++---- lib/src/http/http_request_context.dart | 6 +++--- lib/src/http/http_response_context.dart | 6 +++--- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12c111de..75f5b3da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,4 +19,6 @@ single type argument to determine how to parse a value. single type argument pointing to the underlying request/response type, respectively. * `RequestContext.io` and `ResponseContext.io` are now permanently -gone. \ No newline at end of file +gone. +* `HttpRequestContextImpl` and `HttpResponseContextImpl` were renamed to +`HttpRequestContext` and `HttpResponseContext`. \ No newline at end of file diff --git a/lib/src/http/angel_http.dart b/lib/src/http/angel_http.dart index 376e4c43..dda37b8f 100644 --- a/lib/src/http/angel_http.dart +++ b/lib/src/http/angel_http.dart @@ -340,10 +340,10 @@ class AngelHttp { }); } - Future createRequestContext(HttpRequest request) { + Future createRequestContext(HttpRequest request) { var path = request.uri.path.replaceAll(_straySlashes, ''); if (path.length == 0) path = '/'; - return HttpRequestContextImpl.from(request, app, path).then((req) { + return HttpRequestContext.from(request, app, path).then((req) { if (_pool != null) req.inject(PoolResource, _pool.request()); if (app.injections.isNotEmpty) app.injections.forEach(req.inject); return req; @@ -352,8 +352,8 @@ class AngelHttp { Future createResponseContext(HttpResponse response, [RequestContext correspondingRequest]) => - new Future.value(new HttpResponseContextImpl( - response, app, correspondingRequest as HttpRequestContextImpl) + new Future.value(new HttpResponseContext( + response, app, correspondingRequest as HttpRequestContext) ..serializer = (app.serializer ?? json.encode) ..encoders.addAll(app.encoders ?? {})); diff --git a/lib/src/http/http_request_context.dart b/lib/src/http/http_request_context.dart index aad06e20..6e7f28cb 100644 --- a/lib/src/http/http_request_context.dart +++ b/lib/src/http/http_request_context.dart @@ -7,7 +7,7 @@ import 'package:http_parser/http_parser.dart'; import '../core/core.dart'; /// An implementation of [RequestContext] that wraps a [HttpRequest]. -class HttpRequestContextImpl extends RequestContext { +class HttpRequestContext extends RequestContext { MediaType _contentType; HttpRequest _io; String _override, _path; @@ -75,9 +75,9 @@ class HttpRequestContextImpl extends RequestContext { } /// Magically transforms an [HttpRequest] into a [RequestContext]. - static Future from( + static Future from( HttpRequest request, Angel app, String path) { - HttpRequestContextImpl ctx = new HttpRequestContextImpl(); + HttpRequestContext ctx = new HttpRequestContext(); String override = request.method; diff --git a/lib/src/http/http_response_context.dart b/lib/src/http/http_response_context.dart index 6cd2ab13..dc244d31 100644 --- a/lib/src/http/http_response_context.dart +++ b/lib/src/http/http_response_context.dart @@ -4,16 +4,16 @@ import 'dart:io'; import '../core/core.dart'; import 'http_request_context.dart'; -class HttpResponseContextImpl extends ResponseContext { +class HttpResponseContext extends ResponseContext { /// The underlying [HttpResponse] under this instance. @override final HttpResponse rawResponse; Angel app; - final HttpRequestContextImpl _correspondingRequest; + final HttpRequestContext _correspondingRequest; bool _isClosed = false, _useStream = false; - HttpResponseContextImpl(this.rawResponse, this.app, [this._correspondingRequest]); + HttpResponseContext(this.rawResponse, this.app, [this._correspondingRequest]); @override RequestContext get correspondingRequest {