| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | namespace Azure.Core.Pipeline |
| | 5 | | { |
| | 6 | | internal class ClientRequestIdPolicy : HttpPipelineSynchronousPolicy |
| | 7 | | { |
| | 8 | | internal const string ClientRequestIdHeader = "x-ms-client-request-id"; |
| | 9 | | internal const string EchoClientRequestId = "x-ms-return-client-request-id"; |
| | 10 | |
|
| 2 | 11 | | protected ClientRequestIdPolicy() |
| | 12 | | { |
| 2 | 13 | | } |
| | 14 | |
|
| 60 | 15 | | public static ClientRequestIdPolicy Shared { get; } = new ClientRequestIdPolicy(); |
| | 16 | |
|
| | 17 | | public override void OnSendingRequest(HttpMessage message) |
| | 18 | | { |
| 1638 | 19 | | message.Request.Headers.SetValue(ClientRequestIdHeader, message.Request.ClientRequestId); |
| 1638 | 20 | | message.Request.Headers.SetValue(EchoClientRequestId, "true"); |
| 1638 | 21 | | } |
| | 22 | | } |
| | 23 | | } |