Skip to main content

azure_core/http/
headers.rs

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
4//! HTTP headers.
5
6// Re-export headers to flatten out this module with typespec_client_core.
7pub use typespec_client_core::http::headers::*;
8
9// HTTP headers are case-insensitive.
10// We use lowercase below for simple comparisons downstream.
11
12/// x-ms-client-request-id header. See <https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#distributed-tracing--telemetry> for more details.
13pub const CLIENT_REQUEST_ID: HeaderName = HeaderName::from_static("x-ms-client-request-id");
14/// x-ms-error-code header. See <https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors> for more details.
15pub const ERROR_CODE: HeaderName = HeaderName::from_static("x-ms-error-code");
16/// x-ms-date header.
17pub const MS_DATE: HeaderName = HeaderName::from_static("x-ms-date");
18/// x-ms-request-id header. See <https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#distributed-tracing--telemetry> for more details.
19pub(crate) const REQUEST_ID: HeaderName = HeaderName::from_static("x-ms-request-id");
20/// retry-after-ms header.
21pub const RETRY_AFTER_MS: HeaderName = HeaderName::from_static("retry-after-ms");
22/// x-ms-version header.
23pub const VERSION: HeaderName = HeaderName::from_static("x-ms-version");
24/// x-ms-retry-after-ms header.
25pub const X_MS_RETRY_AFTER_MS: HeaderName = HeaderName::from_static("x-ms-retry-after-ms");
26
27/// Constants related to the Content-Type header
28///
29/// <https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Type>
30pub mod content_type {
31    use crate::http::headers::HeaderValue;
32
33    // Form content types
34    // https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4
35
36    /// The content type for form payloads. See <https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4> for more details.
37    pub const APPLICATION_X_WWW_FORM_URLENCODED: HeaderValue =
38        HeaderValue::from_static("application/x-www-form-urlencoded");
39}