Browse Source

Merge pull request #10074 from abpframework/maliming/AbpNoContentActionFilter

Check `Response.HasStarted` in `AbpNoContentActionFilter`.
pull/10075/head
liangshiwei 5 years ago
committed by GitHub
parent
commit
c164519e23
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Response/AbpNoContentActionFilter.cs

7
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Response/AbpNoContentActionFilter.cs

@ -18,8 +18,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Response
await next();
if (context.HttpContext.Response.StatusCode == (int)HttpStatusCode.OK
&& context.Result == null)
if (!context.HttpContext.Response.HasStarted &&
context.HttpContext.Response.StatusCode == (int)HttpStatusCode.OK &&
context.Result == null)
{
var returnType = context.ActionDescriptor.GetReturnType();
if (returnType == typeof(Task) || returnType == typeof(void))
@ -29,4 +30,4 @@ namespace Volo.Abp.AspNetCore.Mvc.Response
}
}
}
}
}

Loading…
Cancel
Save