Added HttpResponseContext.detach
This commit is contained in:
parent
fdd1ca16c9
commit
be521dcd7f
1 changed files with 21 additions and 13 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue