-
Notifications
You must be signed in to change notification settings - Fork 3k
[core] add HttpRequest and HttpResponse reprs #16972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -267,7 +267,7 @@ def __init__(self, request: HttpRequest, aiohttp_response: aiohttp.ClientRespons | |||
self.status_code = aiohttp_response.status | |||
self.headers = CIMultiDict(aiohttp_response.headers) | |||
self.reason = aiohttp_response.reason | |||
self.content_type = aiohttp_response.headers.get('content-type') | |||
self.content_type = self.headers.get('content-type') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callout: I think this should be self.headers
instead of aiohttp_response.headers
, bc we made self.headers
case insensitive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, from a functional perspective, this shouldn't matter since aiohttp_response.headers
is also case-insensitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lmazuel had brought that up too, I'll just revert this change
…into add_reprs * 'master' of https://github.com/Azure/azure-sdk-for-python: (71 commits) EG - more docs imrpovement (Azure#17079) [EventHubs] add logging.info to warn the usage of partition key of non-string type (Azure#17057) march release (Azure#16966) Release of Device Update for IoT Hub SDK for Python. (Azure#17005) Add Get-AllPackageInfoFromRepo (Azure#16947) Track1 package is incorrectly set as track2 (Azure#17075) [text analytics] add normalized_text (Azure#17074) Renaming with_token identity function (Azure#17066) Adapt to azure core's cloud event (Azure#17063) align perf tests with js (Azure#17069) [Perfstress][Storage] Added FileShare perf tests (Azure#15834) [formrecognizer] Adding custom forms perf test (Azure#16969) Fix LanguageShort typo (Azure#17068) sas creds updates (Azure#17065) [eventgrid] Fix Sample eh (Azure#17064) [Perfstress][Storage] Added Datalake perf tests (Azure#15861) [text analytics] Healthcare n-ary relations (Azure#16997) ServiceBus dict-representation acceptance and kwarg-update functionality (Azure#14807) [text analytics] add perf tests (Azure#17060) Add cloud event to core (Azure#16800) ...
@@ -592,6 +594,15 @@ def raise_for_status(self): | |||
if self.status_code >= 400: | |||
raise HttpResponseError(response=self) | |||
|
|||
def __repr__(self): | |||
# there doesn't have to be a content type | |||
content_type_str = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I would exclude the content type key/value altogether in the repr if we don't know what it is (i.e. not add , Content-Type:
to the output...
/azp run python - core - ci |
/azp run python - cosmos - ci |
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verbal approval for this PR was given, I'm just approving so we can merge.
thanks @kristapratico , @johanste and @lmazuel have already given their verbal approval |
…into assertions * 'master' of https://github.com/Azure/azure-sdk-for-python: [core] add HttpRequest and HttpResponse reprs (Azure#16972) [text analytics] add actual normalized_text tests (Azure#17123) update samples to use actual role names (Azure#17124) Sync eng/common directory with azure-sdk-tools for PR 1448 (Azure#17085) Enable APIView status check (Azure#17107) Fix PackageName typo (Azure#17109) Move SetTestPipelineVersion.ps1 to eng/common (Azure#17103) Fix paths for non-windows agents (Azure#17096) [Communication] - Identity - Update README (Azure#17091) Rename CertificateCredential's certificate_bytes -> certificate_data (Azure#17090) fix shared reqs (Azure#17095) [translation] initial library (Azure#16837) EG - more docs imrpovement (Azure#17079) [EventHubs] add logging.info to warn the usage of partition key of non-string type (Azure#17057) march release (Azure#16966) Release of Device Update for IoT Hub SDK for Python. (Azure#17005) Add Get-AllPackageInfoFromRepo (Azure#16947) Track1 package is incorrectly set as track2 (Azure#17075)
…into ta-v5.1.0b6-analyze * 'master' of https://github.com/Azure/azure-sdk-for-python: (24 commits) [text analytics] PII updates for v5.1.0b6 (Azure#17038) Fix bug where imported matrix parameter duplicates are not overrided (Azure#17126) Add NULL to readme (Azure#17076) Sas batching (Azure#17133) dropping py3.5 (Azure#17127) [EventHubs] 5.3.1 update changelog (Azure#17132) [text analytics] assertions (Azure#17098) add recordings (Azure#17125) [core] add HttpRequest and HttpResponse reprs (Azure#16972) [text analytics] add actual normalized_text tests (Azure#17123) update samples to use actual role names (Azure#17124) Sync eng/common directory with azure-sdk-tools for PR 1448 (Azure#17085) Enable APIView status check (Azure#17107) Fix PackageName typo (Azure#17109) Move SetTestPipelineVersion.ps1 to eng/common (Azure#17103) Fix paths for non-windows agents (Azure#17096) [Communication] - Identity - Update README (Azure#17091) Rename CertificateCredential's certificate_bytes -> certificate_data (Azure#17090) fix shared reqs (Azure#17095) [translation] initial library (Azure#16837) ...
fixes #16952