Rename HTTP request+response impl, drop the "impl"
This commit is contained in:
parent
90409711b4
commit
d3a3d93796
4 changed files with 13 additions and 11 deletions
|
@ -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.
|
||||
gone.
|
||||
* `HttpRequestContextImpl` and `HttpResponseContextImpl` were renamed to
|
||||
`HttpRequestContext` and `HttpResponseContext`.
|
|
@ -340,10 +340,10 @@ class AngelHttp {
|
|||
});
|
||||
}
|
||||
|
||||
Future<HttpRequestContextImpl> createRequestContext(HttpRequest request) {
|
||||
Future<HttpRequestContext> 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<ResponseContext> createResponseContext(HttpResponse response,
|
||||
[RequestContext correspondingRequest]) =>
|
||||
new Future<ResponseContext>.value(new HttpResponseContextImpl(
|
||||
response, app, correspondingRequest as HttpRequestContextImpl)
|
||||
new Future<ResponseContext>.value(new HttpResponseContext(
|
||||
response, app, correspondingRequest as HttpRequestContext)
|
||||
..serializer = (app.serializer ?? json.encode)
|
||||
..encoders.addAll(app.encoders ?? {}));
|
||||
|
||||
|
|
|
@ -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<HttpRequest> {
|
||||
class HttpRequestContext extends RequestContext<HttpRequest> {
|
||||
MediaType _contentType;
|
||||
HttpRequest _io;
|
||||
String _override, _path;
|
||||
|
@ -75,9 +75,9 @@ class HttpRequestContextImpl extends RequestContext<HttpRequest> {
|
|||
}
|
||||
|
||||
/// Magically transforms an [HttpRequest] into a [RequestContext].
|
||||
static Future<HttpRequestContextImpl> from(
|
||||
static Future<HttpRequestContext> from(
|
||||
HttpRequest request, Angel app, String path) {
|
||||
HttpRequestContextImpl ctx = new HttpRequestContextImpl();
|
||||
HttpRequestContext ctx = new HttpRequestContext();
|
||||
|
||||
String override = request.method;
|
||||
|
||||
|
|
|
@ -4,16 +4,16 @@ import 'dart:io';
|
|||
import '../core/core.dart';
|
||||
import 'http_request_context.dart';
|
||||
|
||||
class HttpResponseContextImpl extends ResponseContext<HttpResponse> {
|
||||
class HttpResponseContext extends ResponseContext<HttpResponse> {
|
||||
/// 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 {
|
||||
|
|
Loading…
Reference in a new issue