Added HttpResponseContext.detach

This commit is contained in:
Tobe O 2018-08-28 09:48:55 -04:00
parent fdd1ca16c9
commit be521dcd7f

View file

@ -15,10 +15,16 @@ class HttpResponseContext extends ResponseContext<HttpResponse> {
LockableBytesBuilder _buffer;
final HttpRequestContext _correspondingRequest;
bool _isClosed = false, _streamInitialized = false;
bool _detached = false, _isClosed = false, _streamInitialized = false;
HttpResponseContext(this.rawResponse, this.app, [this._correspondingRequest]);
@override
HttpResponse detach() {
_detached = true;
return rawResponse;
}
@override
RequestContext get correspondingRequest {
return _correspondingRequest;
@ -166,6 +172,7 @@ class HttpResponseContext extends ResponseContext<HttpResponse> {
@override
Future close() {
if (!_detached) {
if (!_isClosed) {
if (!isBuffered) {
try {
@ -182,6 +189,7 @@ class HttpResponseContext extends ResponseContext<HttpResponse> {
}
super.close();
}
return new Future.value();
}
}