-
Notifications
You must be signed in to change notification settings - Fork 351
Fix for #147 #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for #147 #185
Conversation
@Tratcher I would appreciate you giving this a look. Seems reasonable to me though it adds a few more overloads to the public surface. Any concerns? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests?
@@ -60,6 +72,9 @@ protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage | |||
} | |||
catch (Exception exception) | |||
{ | |||
if (_rethrowExceptions) | |||
throw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: include the braces please.
using System.Web.Http.Hosting; | ||
using Microsoft.TestCommon; | ||
|
||
namespace System.Web.Http.Cors | ||
{ | ||
public class CorsMessageHandlerTest | ||
{ | ||
private class PassthroughExceptionHandler : IExceptionHandler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feels like it's not the best place for this class, however i have no idea where it should be placed(
Any suggestions would be appreciated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bottom of this class is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
{ | ||
HttpConfiguration config = new HttpConfiguration(); | ||
config.Routes.MapHttpRoute("default", "{controller}"); | ||
config.Services.Replace(typeof(IExceptionHandler), new PassthroughExceptionHandler()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed to reproduce the exact scenario of original issue, otherwise default implementation of IExceptionHandler maps Exceptions to just 500 status code
I added tests and braces. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small change, then we sit for a couple of days
using System.Web.Http.Hosting; | ||
using Microsoft.TestCommon; | ||
|
||
namespace System.Web.Http.Cors | ||
{ | ||
public class CorsMessageHandlerTest | ||
{ | ||
private class PassthroughExceptionHandler : IExceptionHandler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bottom of this class is fine.
@@ -26,16 +26,38 @@ public static class CorsHttpConfigurationExtensions | |||
/// <param name="httpConfiguration">The <see cref="HttpConfiguration"/>.</param> | |||
public static void EnableCors(this HttpConfiguration httpConfiguration) | |||
{ | |||
EnableCors(httpConfiguration, null); | |||
EnableCors(httpConfiguration, null, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI we've got a meeting scheduled next Tuesday to decide whether default should be true
i.e. whether we should break compatibility to ensure IExceptionHandler
sees what it should. Will let you know…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decision was to avoid breaking changes and stick with the approach you've implemented here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we stick with swallow-exceptions-by-default, this is ready to go.
Adresses #147