Port 7.7 - WIP

This commit is contained in:
Stephan
2017-09-12 16:22:16 +02:00
parent 1c96df83cd
commit 96c08f24ee
176 changed files with 5490 additions and 4892 deletions

View File

@@ -28,9 +28,17 @@ namespace Umbraco.Web.WebApi
internal static Attempt<IOwinContext> TryGetOwinContext(this HttpRequestMessage request)
{
var httpContext = request.TryGetHttpContext();
return httpContext
? Attempt.Succeed(httpContext.Result.GetOwinContext())
: Attempt<IOwinContext>.Fail();
try
{
return httpContext
? Attempt.Succeed(httpContext.Result.GetOwinContext())
: Attempt<IOwinContext>.Fail();
}
catch (InvalidOperationException)
{
//this will occur if there is no OWIN environment which generally would only be in things like unit tests
return Attempt<IOwinContext>.Fail();
}
}
/// <summary>