/// <summary>
        /// OnAsyncMethodEnd callback
        /// </summary>
        /// <typeparam name="TTarget">Type of the target</typeparam>
        /// <typeparam name="TResponse">Type of the response, in an async scenario will be T of Task of T</typeparam>
        /// <param name="instance">Instance value, aka `this` of the instrumented method.</param>
        /// <param name="responseMessage">HttpResponse message instance</param>
        /// <param name="exception">Exception instance in case the original code threw an exception.</param>
        /// <param name="state">Calltarget state value</param>
        /// <returns>A response value, in an async scenario will be T of Task of T</returns>
        public static CallTargetReturn <TResponse> OnMethodEnd <TTarget, TResponse>(TTarget instance, TResponse responseMessage, Exception exception, CallTargetState state)
            where TResponse : IHttpResponseMessage
        {
            var response = SocketsHttpHandlerCommon.OnMethodEnd(instance, responseMessage, exception, state);

            return(new CallTargetReturn <TResponse>(response));
        }
Exemplo n.º 2
0
 /// <summary>
 /// OnAsyncMethodEnd callback
 /// </summary>
 /// <typeparam name="TTarget">Type of the target</typeparam>
 /// <typeparam name="TResponse">Type of the response, in an async scenario will be T of Task of T</typeparam>
 /// <param name="instance">Instance value, aka `this` of the instrumented method.</param>
 /// <param name="responseMessage">HttpResponse message instance</param>
 /// <param name="exception">Exception instance in case the original code threw an exception.</param>
 /// <param name="state">Calltarget state value</param>
 /// <returns>A response value, in an async scenario will be T of Task of T</returns>
 public static TResponse OnAsyncMethodEnd <TTarget, TResponse>(TTarget instance, TResponse responseMessage, Exception exception, CallTargetState state)
     where TResponse : IHttpResponseMessage
 {
     return(SocketsHttpHandlerCommon.OnMethodEnd(instance, responseMessage, exception, state));
 }
Exemplo n.º 3
0
 /// <summary>
 /// OnMethodBegin callback
 /// </summary>
 /// <typeparam name="TTarget">Type of the target</typeparam>
 /// <typeparam name="TRequest">Type of the request</typeparam>
 /// <param name="instance">Instance value, aka `this` of the instrumented method.</param>
 /// <param name="requestMessage">HttpRequest message instance</param>
 /// <param name="cancellationToken">CancellationToken value</param>
 /// <returns>Calltarget state value</returns>
 public static CallTargetState OnMethodBegin <TTarget, TRequest>(TTarget instance, TRequest requestMessage, CancellationToken cancellationToken)
     where TRequest : IHttpRequestMessage
 {
     return(SocketsHttpHandlerCommon.OnMethodBegin(instance, requestMessage, cancellationToken));
 }