autorest
autorest copied to clipboard
Generated code sets x-ms-client-request-id even when a custom one is present
Given Swagger for an operation that includes a header parameter marked with the custom x-ms-client-request-id extension, AutoRest generates C# code like this:
// Set Headers
httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", Guid.NewGuid().ToString());
if (this.Client.AcceptLanguage != null)
{
if (httpRequest.Headers.Contains("accept-language"))
{
httpRequest.Headers.Remove("accept-language");
}
httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
}
if (clientRequestId != null)
{
if (httpRequest.Headers.Contains("client-request-id"))
{
httpRequest.Headers.Remove("client-request-id");
}
httpRequest.Headers.TryAddWithoutValidation("client-request-id", clientRequestId);
}
The first line to set the x-ms-client-request-id header should not be present.
This is fixed now
Thanks!