diff --git a/src/Nancy/NancyEngine.cs b/src/Nancy/NancyEngine.cs index ba57d8df7d..b9a13b47ab 100644 --- a/src/Nancy/NancyEngine.cs +++ b/src/Nancy/NancyEngine.cs @@ -95,7 +95,8 @@ public NancyEngine(IRequestDispatcher dispatcher, public Task HandleRequest(Request request, Func preRequest, CancellationToken cancellationToken) { - var cts = CancellationTokenSource.CreateLinkedTokenSource(this.engineDisposedCts.Token, cancellationToken); + using(var cts = CancellationTokenSource.CreateLinkedTokenSource(this.engineDisposedCts.Token, cancellationToken)) + { cts.Token.ThrowIfCancellationRequested(); var tcs = new TaskCompletionSource(); @@ -138,10 +139,6 @@ public Task HandleRequest(Request request, Func HandleRequest(Request request, Func