Beispiel #1
0
        private static void Deliver(Request request, Response response, Action action = null)
        {
            if (request.IsCanceled)
            {
                request.Finish("canceled-at-delivery");
                return;
            }

            if (response.IsSuccess)
            {
                request.SetResponse(response);
            }
            else
            {
                request.SetError(response.Error);
            }

            if (response.IsIntermediate)
            {
                request.AddMarker("intermediate-response");
            }
            else
            {
                request.Finish("done");
            }

            if (action != null)
            {
                action();
            }
        }
Beispiel #2
0
 public void PostResponse(Request request, Response response, Action action = null)
 {
     request.AddMarker("post-response");
     _invoke(() => Deliver(request, response, action));
 }
Beispiel #3
0
 public void PostError(Request request, Error error)
 {
     request.AddMarker("post-error");
     var response = new Response { Error = error };
     _invoke(() => Deliver(request, response));
 }