-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unredact headers and query params for logging (#18117)
- Loading branch information
1 parent
064e436
commit 2ada230
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_helpers.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# coding=utf-8 | ||
# ------------------------------------ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
# ------------------------------------ | ||
|
||
from azure.core.pipeline.policies import HttpLoggingPolicy | ||
|
||
|
||
def get_http_logging_policy(**kwargs): | ||
http_logging_policy = HttpLoggingPolicy(**kwargs) | ||
http_logging_policy.allowed_header_names.update( | ||
{ | ||
"Operation-Location", | ||
"Content-Encoding", | ||
"Vary", | ||
"apim-request-id", | ||
"X-RequestId", | ||
"Set-Cookie", | ||
"X-Powered-By", | ||
"Strict-Transport-Security", | ||
"x-content-type-options" | ||
} | ||
) | ||
http_logging_policy.allowed_query_params.update( | ||
{ | ||
"$top", | ||
"$skip", | ||
"$maxpagesize", | ||
"ids", | ||
"statuses", | ||
"createdDateTimeUtcStart", | ||
"createdDateTimeUtcEnd", | ||
"$orderBy" | ||
} | ||
) | ||
return http_logging_policy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters