Remove req.inject
This commit is contained in:
parent
a814e3d1a7
commit
cfc5991fff
2 changed files with 3 additions and 13 deletions
|
@ -30,7 +30,8 @@ replaced with `parseBody`, `parseUploadedFiles`, and `parseRawRequestBuffer`, re
|
||||||
* Removed the synchronous equivalents of the above methods (`body`, `files`, and `originalBuffer`),
|
* Removed the synchronous equivalents of the above methods (`body`, `files`, and `originalBuffer`),
|
||||||
as well as `query`.
|
as well as `query`.
|
||||||
* Removed `Angel.injections` and `RequestContext.injections`.
|
* Removed `Angel.injections` and `RequestContext.injections`.
|
||||||
* Removed `Angel.inject`.
|
* Removed `Angel.inject` and `RequestContext.inject`.
|
||||||
* Removed a dependency on `package:pool`, which also meant removing `AngelHttp.throttle`.
|
* Removed a dependency on `package:pool`, which also meant removing `AngelHttp.throttle`.
|
||||||
* Remove the `RequestMiddleware` typedef; from now on, one should use `ResponseContext.end`
|
* Remove the `RequestMiddleware` typedef; from now on, one should use `ResponseContext.end`
|
||||||
exclusively to close responses.
|
exclusively to close responses.
|
||||||
|
* `waterfall` will now only accept `RequestHandler`.
|
|
@ -112,17 +112,6 @@ abstract class RequestContext<RawRequest> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Shorthand to add to [_injections].
|
|
||||||
void inject(type, value) {
|
|
||||||
if (!app.isProduction && type is Type) {
|
|
||||||
if (!reflect(value).type.isAssignableTo(reflectType(type)))
|
|
||||||
throw new ArgumentError(
|
|
||||||
'Cannot inject $value (${value.runtimeType}) as an instance of $type.');
|
|
||||||
}
|
|
||||||
|
|
||||||
_injections[type] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns `true` if the client's `Accept` header indicates that the given [contentType] is considered a valid response.
|
/// Returns `true` if the client's `Accept` header indicates that the given [contentType] is considered a valid response.
|
||||||
///
|
///
|
||||||
/// You cannot provide a `null` [contentType].
|
/// You cannot provide a `null` [contentType].
|
||||||
|
|
Loading…
Reference in a new issue