Browse Source
Merge pull request #809 from colinin/fix-wrapper-http-response-header
fix(wrapper): repeated response header
pull/819/head
yx lin
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
8 additions and
2 deletions
-
aspnet-core/modules/mvc/LINGYUN.Abp.AspNetCore.Mvc.Idempotent.Wrapper/LINGYUN/Abp/AspNetCore/Mvc/Idempotent/Wrapper/IdempotentHttpResponseWrapper.cs
-
aspnet-core/modules/mvc/LINGYUN.Abp.AspNetCore.Mvc.Wrapper/LINGYUN/Abp/AspNetCore/Mvc/HttpResponseWrapper.cs
|
|
|
@ -26,7 +26,10 @@ public class IdempotentHttpResponseWrapper : HttpResponseWrapper, ITransientDepe |
|
|
|
{ |
|
|
|
if (context.HttpContext.Items.TryGetValue(nameof(IdempotentAttribute.RedirectUrl), out var redirectUrl) && redirectUrl != null) |
|
|
|
{ |
|
|
|
context.HttpContext.Response.Headers.Add(AbpHttpWrapConsts.AbpWrapResult, "true"); |
|
|
|
if (!context.HttpContext.Response.Headers.ContainsKey(AbpHttpWrapConsts.AbpWrapResult)) |
|
|
|
{ |
|
|
|
context.HttpContext.Response.Headers.Add(AbpHttpWrapConsts.AbpWrapResult, "true"); |
|
|
|
} |
|
|
|
context.HttpContext.Response.Redirect(redirectUrl.ToString()); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
@ -22,7 +22,10 @@ public class HttpResponseWrapper : IHttpResponseWrapper, ITransientDependency |
|
|
|
{ |
|
|
|
foreach (var header in context.HttpHeaders) |
|
|
|
{ |
|
|
|
context.HttpContext.Response.Headers.Add(header.Key, header.Value); |
|
|
|
if (!context.HttpContext.Response.Headers.ContainsKey(header.Key)) |
|
|
|
{ |
|
|
|
context.HttpContext.Response.Headers.Add(header.Key, header.Value); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|