Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions sdk/core/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,16 @@ pub mod resource_manager_endpoint {
/// Azure Resource Manager US government cloud endpoint
pub const AZURE_US_GOVERNMENT_CLOUD: &str = "https://management.usgovcloudapi.net";
}

/// https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Type
pub mod content_type {

// Form content types
// https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4

pub const MULTIPART_FORM_DATA: &str = "multipart/form-data";
pub const APPLICATION_X_WWW_FORM_URLENCODED: &str = "application/x-www-form-urlencoded";

pub const APPLICATION_XML: &str = "application/xml";
pub const APPLICATION_JSON: &str = "application/json";
}
31 changes: 30 additions & 1 deletion sdk/core/src/headers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,54 +209,81 @@ pub fn add_mandatory_header<T: Header>(item: &T, builder: Builder) -> Builder {
builder.header(item.name().as_str(), item.value().as_str())
}

// headers are case insensitive
// we are using all lowercase values
// same as https://github.com/hyperium/http/blob/master/util/src/main.rs

pub const ACL: &str = "x-ms-acl";
pub const ACCOUNT_KIND: &str = "x-ms-account-kind";
pub const ACTIVITY_ID: &str = "x-ms-activity-id";
pub const APP: &str = "x-ms-app";
pub const AUTHORIZATION: &str = "authorization";
pub const APPEND_POSITION: &str = "x-ms-blob-condition-appendpos";
pub const BLOB_ACCESS_TIER: &str = "x-ms-access-tier";
pub const BLOB_CONTENT_LENGTH: &str = "x-ms-blob-content-length";
pub const BLOB_PUBLIC_ACCESS: &str = "x-ms-blob-public-access";
pub const BLOB_SEQUENCE_NUMBER: &str = "x-ms-blob-sequence-number";
pub const BLOB_TYPE: &str = "x-ms-blob-type";
pub const CACHE_CONTROL: &str = "x-ms-blob-cache-control";
pub const BLOB_CACHE_CONTROL: &str = "x-ms-blob-cache-control";
pub const CACHE_CONTROL: &str = "cache-control";
pub const CLIENT_REQUEST_ID: &str = "x-ms-client-request-id";
pub const CLIENT_VERSION: &str = "x-ms-client-version";
pub const CONTENT_DISPOSITION: &str = "x-ms-blob-content-disposition";
pub const CONTENT_ENCODING: &str = "content-encoding";
pub const CONTENT_LANGUAGE: &str = "content-language";
pub const CONTENT_LENGTH: &str = "content-length";
pub const CONTENT_LOCATION: &str = "content-location";
pub const CONTENT_MD5: &str = "content-md5";
pub const CONTENT_RANGE: &str = "content-range";
pub const CONTENT_SECURITY_POLICY: &str = "content-security-policy";
pub const CONTENT_TYPE: &str = "content-type";
pub const CONTINUATION: &str = "x-ms-continuation";
pub const COPY_COMPLETION_TIME: &str = "x-ms-copy-completion-time";
pub const COPY_PROGRESS: &str = "x-ms-copy-progress";
pub const COPY_SOURCE: &str = "x-ms-copy-source";
pub const COPY_STATUS: &str = "x-ms-copy-status";
pub const COPY_STATUS_DESCRIPTION: &str = "x-ms-copy-status-description";
pub const CREATION_TIME: &str = "x-ms-creation-time";
pub const DATE: &str = "date";
pub const DELETE_SNAPSHOTS: &str = "x-ms-delete-snapshots";
pub const DELETE_TYPE_PERMANENT: &str = "x-ms-delete-type-permanent";
pub const ETAG: &str = "etag";
pub const HAS_IMMUTABILITY_POLICY: &str = "x-ms-has-immutability-policy";
pub const HAS_LEGAL_HOLD: &str = "x-ms-has-legal-hold";
pub const IF_MATCH: &str = "if-match";
pub const IF_MODIFIED_SINCE: &str = "if-modified-since";
pub const IF_NONE_MATCH: &str = "if-none-match";
pub const IF_RANGE: &str = "if-range";
pub const IF_UNMODIFIED_SINCE: &str = "if-unmodified-since";
pub const IF_SEQUENCE_NUMBER_EQ: &str = "x-ms-if-sequence-number-eq";
pub const IF_SEQUENCE_NUMBER_LE: &str = "x-ms-if-sequence-number-le";
pub const IF_SEQUENCE_NUMBER_LT: &str = "x-ms-if-sequence-number-lt";
pub const ITEM_COUNT: &str = "x-ms-item-count";
pub const ITEM_TYPE: &str = "x-ms-item-type";
pub const KEEP_ALIVE: &str = "keep-alive";
pub const LAST_MODIFIED: &str = "last-modified";
pub const LEASE_ACTION: &str = "x-ms-lease-action";
pub const LEASE_BREAK_PERIOD: &str = "x-ms-lease-break-period";
pub const LEASE_DURATION: &str = "x-ms-lease-duration";
pub const LEASE_ID: &str = "x-ms-lease-id";
pub const LEASE_STATE: &str = "x-ms-lease-state";
pub const LEASE_STATUS: &str = "x-ms-lease-status";
pub const LEASE_TIME: &str = "x-ms-lease-time";
pub const LINK: &str = "link";
pub const LOCATION: &str = "location";
pub const MAX_ITEM_COUNT: &str = "x-ms-max-item-count";
pub const META_PREFIX: &str = "x-ms-meta-";
pub const MS_DATE: &str = "x-ms-date";
pub const NAMESPACE_ENABLED: &str = "x-ms-namespace-enabled";
pub const PAGE_WRITE: &str = "x-ms-page-write";
pub const PROPERTIES: &str = "x-ms-properties";
pub const PROPOSED_LEASE_ID: &str = "x-ms-proposed-lease-id";
pub const RANGE: &str = "range";
pub const RANGE_GET_CONTENT_MD5: &str = "x-ms-range-get-content-md5";
pub const REQUEST_ID: &str = "x-ms-request-id";
pub const REQUEST_SERVER_ENCRYPTED: &str = "x-ms-request-server-encrypted";
pub const REQUIRES_SYNC: &str = "x-ms-requires-sync";
pub const RETRY_AFTER: &str = "retry-after";
pub const SERVER_ENCRYPTED: &str = "x-ms-server-encrypted";
pub const SESSION_TOKEN: &str = "x-ms-session-token";
pub const SKU_NAME: &str = "x-ms-sku-name";
Expand All @@ -266,4 +293,6 @@ pub const SOURCE_IF_NONE_MATCH: &str = "x-ms-source-if-none-match";
pub const SOURCE_IF_UNMODIFIED_SINCE: &str = "x-ms-source-if-unmodified-since";
pub const SOURCE_LEASE_ID: &str = "x-ms-source-lease-id";
pub const USER: &str = "x-ms-user";
pub const USER_AGENT: &str = "user-agent";
pub const VERSION: &str = "x-ms-version";
pub const WWW_AUTHENTICATE: &str = "www-authenticate";
3 changes: 2 additions & 1 deletion sdk/storage/src/core/clients/storage_account_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ use azure_core::auth::TokenCredential;
use azure_core::headers::*;
use azure_core::HttpClient;
use bytes::Bytes;
use http::header::AsHeaderName;
use http::HeaderMap;
use http::{
header::*,
method::Method,
request::{Builder, Request},
};
Expand Down