Skip to content

Conversation

andrewmathew1
Copy link
Contributor

This PR introduces a way to get response headers for given control plane operations on containers and databases. This is availble for both the async and sync client. Similar to #35791 for response headers at the item level.

@Copilot Copilot AI review requested due to automatic review settings June 24, 2025 20:03
@andrewmathew1 andrewmathew1 requested a review from a team as a code owner June 24, 2025 20:03
Copilot

This comment was marked as outdated.

@andrewmathew1 andrewmathew1 requested a review from Copilot June 24, 2025 20:25
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds support for retrieving response headers for control plane operations (databases and containers) on the Cosmos service, for both synchronous and asynchronous clients.

  • Introduces new test cases to verify that response headers are returned for various operations.
  • Adds a new get_response_headers method and initializes _response_headers in the Database and Container classes (including their async counterparts).

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sdk/cosmos/azure-cosmos/tests/test_cosmos_responses_async.py Added async tests for response headers on database and container operations.
sdk/cosmos/azure-cosmos/tests/test_cosmos_responses.py Added sync tests for response headers on database and container operations.
sdk/cosmos/azure-cosmos/azure/cosmos/database.py Added _response_headers initialization and get_response_headers method.
sdk/cosmos/azure-cosmos/azure/cosmos/container.py Added _response_headers initialization and get_response_headers method.
sdk/cosmos/azure-cosmos/azure/cosmos/aio/_database.py Added _response_headers initialization and get_response_headers method for async client.
sdk/cosmos/azure-cosmos/azure/cosmos/aio/_container.py Added _response_headers initialization and get_response_headers method for async client.

Copy link

github-actions bot commented Jun 24, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

azure-cosmos

Copy link
Contributor

@allenkim0129 allenkim0129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were some optimizations and missing functions. I only commented on async codes, but the same comment applies to sync codes. Please address them in both async/sync codes.

I believe if you follow my suggeestions, you won't need @overload or return_headers anymore.

Based on the changes, the tests should be updated accordingly.

Also, you can run pylint and mypy tests locally. Please let me know if you need help with that.

Copy link
Member

@tvaron3 tvaron3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM besides some small comments.

Copy link
Member

@kushagraThapar kushagraThapar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes @andrewmathew1 can we please add samples as well for them if not present already, thanks!

Copy link
Member

@tvaron3 tvaron3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM besides few small comments

Copy link
Member

@simorenoh simorenoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small things here and there but looking good - please ensure Anna signs off on the overloading logic

@simorenoh simorenoh requested a review from annatisch September 4, 2025 21:38
Copy link
Contributor

@allenkim0129 allenkim0129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@bambriz bambriz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thank you!

@simorenoh
Copy link
Member

/azp run python - cosmos - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@andrewmathew1 andrewmathew1 merged commit de386d3 into Azure:main Sep 24, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

8 participants