Skip to content

Cosmos: Add support for request options/headers #2587

@analogrelay

Description

@analogrelay

All Cosmos client methods accept an "Options" struct, which allows a user to specify additional options for the request. For example:

/// Options to be passed to APIs that manipulate items.
#[derive(Clone, Default)]
pub struct ItemOptions<'a> {
    pub method_options: ClientMethodOptions<'a>,

    /// When this value is true, write operations will respond with the new value of the resource being written.
    ///
    /// The default for this is `false`, which reduces the network and CPU burden that comes from serializing and deserializing the response.
    pub enable_content_response_on_write: bool,
}

Most of these options translate to headers that should be applied to the HTTP request the method makes.

Compared to other SDKs, the Cosmos crate implements very few of these options. Before GA, we need to review the options provided in other SDKs and port most, if not all, of them to the Rust SDK.

Metadata

Metadata

Assignees

Labels

CosmosThe azure_cosmos crate

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions