Browse Source

Merge pull request #956 from dotnet-architecture/fix/708-duplicate-x-request-headers

Fix duplicate x-requestid headers
pull/957/head
Miguel Veloso 6 years ago
committed by GitHub
parent
commit
13ecdfd540
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      src/Web/WebMVC/Infrastructure/HttpClientRequestIdDelegatingHandler.cs

+ 4
- 1
src/Web/WebMVC/Infrastructure/HttpClientRequestIdDelegatingHandler.cs View File

@ -17,7 +17,10 @@ namespace WebMVC.Infrastructure
{
if (request.Method == HttpMethod.Post || request.Method == HttpMethod.Put)
{
request.Headers.Add("x-requestid", Guid.NewGuid().ToString());
if (!request.Headers.Contains("x-requestid"))
{
request.Headers.Add("x-requestid", Guid.NewGuid().ToString());
}
}
return await base.SendAsync(request, cancellationToken);


Loading…
Cancel
Save