public Task ChallengeAsync( HttpAuthenticationChallengeContext context, CancellationToken cancellationToken ) { ExceptionTestsUtility.CheckForThrow(_throwAt, "AuthenticationChallenge"); return(Task.FromResult <object>(null)); }
public override ContentNegotiationResult Negotiate( Type type, HttpRequestMessage request, IEnumerable <MediaTypeFormatter> formatters ) { ExceptionTestsUtility.CheckForThrow(_throwAt, "ContentNegotiatorNegotiate"); return(base.Negotiate(type, request, formatters)); }
protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { ExceptionTestsUtility.CheckForThrow(_throwAt, "RequestMessageHandler"); HttpResponseMessage response = await base.SendAsync(request, cancellationToken); ExceptionTestsUtility.CheckForThrow(_throwAt, "ResponseMessageHandler"); return(response); }
public override Task <object> ReadFromStreamAsync( Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger ) { ExceptionTestsUtility.CheckForThrow(_throwAt, "MediaTypeFormatterReadFromStreamAsync"); return(base.ReadFromStreamAsync(type, readStream, content, formatterLogger)); }
public override Task WriteToStreamAsync( Type type, object value, Stream writeStream, HttpContent content, TransportContext transportContext ) { ExceptionTestsUtility.CheckForThrow(_throwAt, "MediaTypeFormatterWriteToStreamAsync"); return(base.WriteToStreamAsync(type, value, writeStream, content, transportContext)); }
public string ReturnString([FromBody] string throwAt) { string message = "Hello World!"; // check if the test wants to throw from here ExceptionTestsUtility.CheckForThrow(throwAt, "ActionMethod"); // NOTE: this indicates that we want to throw from here & after this gets intercepted // by the ExceptionFilter, we want to throw from there too ExceptionTestsUtility.CheckForThrow(throwAt, "ActionMethodAndExceptionFilter"); return(message); }
protected override Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { ExceptionTestsUtility.CheckForThrow(_throwAt, "RequestMessageHandler"); return(base.SendAsync(request, cancellationToken).ContinueWith <HttpResponseMessage>((tsk) => { ExceptionTestsUtility.CheckForThrow(_throwAt, "ResponseMessageHandler"); HttpResponseMessage response = tsk.Result; return response; })); }
public override void OnException(HttpActionExecutedContext context) { ExceptionTestsUtility.CheckForThrow(_throwAt, "ActionMethodAndExceptionFilter"); }
public override void OnActionExecuted(HttpActionExecutedContext context) { ExceptionTestsUtility.CheckForThrow(_throwAt, "AfterActionExecuted"); }
public override void OnActionExecuting(HttpActionContext context) { ExceptionTestsUtility.CheckForThrow(_throwAt, "BeforeActionExecuted"); }
public override void OnAuthorization(HttpActionContext context) { ExceptionTestsUtility.CheckForThrow(_throwAt, "RequestAuthorization"); }