Skip to content

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

Merged
merged 6 commits into from
Aug 21, 2018
Merged

Fix for #147 #185

merged 6 commits into from
Aug 21, 2018

Conversation

itrofimow
Copy link

Adresses #147

@dnfclas
Copy link

dnfclas commented Aug 8, 2018

CLA assistant check
All CLA requirements met.

@dougbu
Copy link
Member

dougbu commented Aug 16, 2018

@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?

Copy link
Member

@Tratcher Tratcher left a 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;
Copy link
Member

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
Copy link
Author

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

Copy link
Member

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.

Copy link
Author

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());
Copy link
Author

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

@itrofimow
Copy link
Author

I added tests and braces.

Copy link
Member

@dougbu dougbu left a 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
Copy link
Member

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);
Copy link
Member

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…

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Copy link
Member

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.

Copy link
Member

@dougbu dougbu left a 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.

@dougbu dougbu merged commit 8044f4e into aspnet:master Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants