Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/formrecognizer/Azure.AI.FormRecognizer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

- `FormRecognizerClient` and `FormTrainingClient` support authentication with Azure Active Directory.
- Support to copy a custom model from one Form Recognizer resource to another.
- Headers that were marked as `REDACTED` in error messages and logs are now exposed by default.

### Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class FormRecognizerClientOptions : ClientOptions
public FormRecognizerClientOptions(ServiceVersion version = LatestVersion)
{
Version = version;
AddLoggedHeaders();
}

/// <summary>
Expand Down Expand Up @@ -50,5 +51,19 @@ internal static string GetVersionString(ServiceVersion version)
_ => throw new NotSupportedException($"The service version {version} is not supported."),
};
}

/// <summary>
/// Add headers that are considered safe for logging or including in error messages
/// by default.
/// </summary>
private void AddLoggedHeaders()
{
Diagnostics.LoggedHeaderNames.Add("apim-request-id");
Diagnostics.LoggedHeaderNames.Add("Location");
Diagnostics.LoggedHeaderNames.Add("Operation-Location");
Diagnostics.LoggedHeaderNames.Add("Strict-Transport-Security");
Diagnostics.LoggedHeaderNames.Add("X-Content-Type-Options");
Diagnostics.LoggedHeaderNames.Add("x-envoy-upstream-service-time");
}
}
}