-
Notifications
You must be signed in to change notification settings - Fork 3k
Added Response Headers to Control Plane Operations #41742
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
9368d1f
bd5ab7b
432ebaa
a1d3a08
64829b5
4ebf1cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -100,6 +100,7 @@ def __init__( | |||||
self.id = id | ||||||
self.database_link = "dbs/{}".format(self.id) | ||||||
self._properties = properties | ||||||
self._response_headers = properties | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that _response_headers is always a dictionary. If properties is None, using .copy() in get_response_headers() will fail; consider initializing with {} as a fallback.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
|
||||||
def __repr__(self) -> str: | ||||||
return "<DatabaseProxy [{}]>".format(self.database_link)[:1024] | ||||||
|
@@ -126,6 +127,14 @@ async def _get_properties(self) -> Dict[str, Any]: | |||||
self._properties = await self.read() | ||||||
return self._properties | ||||||
|
||||||
def get_response_headers(self) -> dict[str, Any]: | ||||||
"""Returns a copy of the response headers associated to this response | ||||||
|
||||||
:return: Dict of response headers | ||||||
:rtype: dict[str, Any] | ||||||
""" | ||||||
return self._response_headers.copy() | ||||||
|
||||||
@distributed_trace_async | ||||||
async def read( | ||||||
self, | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -104,6 +104,7 @@ def __init__( | |||||
self.client_connection = client_connection | ||||||
self._is_system_key: Optional[bool] = None | ||||||
self._scripts: Optional[ScriptsProxy] = None | ||||||
self._response_headers = properties | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If 'properties' is None, calling get_response_headers() could lead to an error since .copy() would not be available. Consider defaulting _response_headers to {} when properties is None.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
if properties: | ||||||
self.client_connection._set_container_properties_cache(self.container_link, | ||||||
_build_properties_cache(properties, | ||||||
|
@@ -123,6 +124,14 @@ def _get_properties(self, **kwargs: Any) -> Dict[str, Any]: | |||||
self.read(**kwargs) | ||||||
return self.__get_client_container_caches()[self.container_link] | ||||||
|
||||||
def get_response_headers(self) -> dict[str, Any]: | ||||||
"""Returns a copy of the response headers associated to this response | ||||||
|
||||||
:return: Dict of response headers | ||||||
:rtype: dict[str, Any] | ||||||
""" | ||||||
return self._response_headers.copy() | ||||||
|
||||||
@property | ||||||
def is_system_key(self) -> bool: | ||||||
if self._is_system_key is None: | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -94,6 +94,7 @@ def __init__( | |||||
self.id = id | ||||||
self.database_link: str = "dbs/{}".format(self.id) | ||||||
self._properties: Optional[Dict[str, Any]] = properties | ||||||
self._response_headers = properties | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If 'properties' is None, calling get_response_headers() may raise an AttributeError when attempting to use .copy(). Consider initializing _response_headers to an empty dictionary (e.g., properties or {} if properties is None).
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
|
||||||
def __repr__(self) -> str: | ||||||
return "<DatabaseProxy [{}]>".format(self.database_link)[:1024] | ||||||
|
@@ -120,6 +121,14 @@ def _get_properties(self) -> Dict[str, Any]: | |||||
self._properties = self.read() | ||||||
return self._properties | ||||||
|
||||||
def get_response_headers(self) -> dict[str, Any]: | ||||||
"""Returns a copy of the response headers associated to this response | ||||||
|
||||||
:return: Dict of response headers | ||||||
:rtype: dict[str, Any] | ||||||
""" | ||||||
return self._response_headers.copy() | ||||||
|
||||||
@distributed_trace | ||||||
def read( # pylint:disable=docstring-missing-param | ||||||
self, | ||||||
|
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.
If 'properties' is passed as None, calling .copy() in get_response_headers() will result in an error. Consider initializing _response_headers to {} when properties is None.
Copilot uses AI. Check for mistakes.