http_query/consts.rs
1//! Method token, header field names and media types for the QUERY method.
2
3use http::Method;
4use std::sync::LazyLock;
5
6/// The HTTP QUERY method token, as defined by RFC 10008.
7pub const METHOD_QUERY: &str = "QUERY";
8
9/// The default maximum number of redirects a [`crate::Client`] follows.
10pub const DEFAULT_MAX_REDIRECTS: usize = 10;
11
12static QUERY_METHOD: LazyLock<Method> =
13 LazyLock::new(|| Method::from_bytes(b"QUERY").expect("QUERY is a valid method token"));
14
15/// Returns the [`http::Method`] value for QUERY.
16///
17/// This works regardless of whether the linked `http` version predates the
18/// built-in `Method::QUERY` constant.
19pub fn query_method() -> Method {
20 QUERY_METHOD.clone()
21}
22
23/// The `Accept-Query` header field name (RFC 10008 ยง3).
24pub const HEADER_ACCEPT_QUERY: &str = "accept-query";
25/// The `Allow` header field name.
26pub const HEADER_ALLOW: &str = "allow";
27/// The `Content-Type` header field name.
28pub const HEADER_CONTENT_TYPE: &str = "content-type";
29/// The `Content-Location` header field name.
30pub const HEADER_CONTENT_LOCATION: &str = "content-location";
31/// The `Location` header field name.
32pub const HEADER_LOCATION: &str = "location";
33/// The `Accept` header field name.
34pub const HEADER_ACCEPT: &str = "accept";
35
36/// The `application/json` media type.
37pub const MEDIA_TYPE_JSON: &str = "application/json";
38/// The `application/x-www-form-urlencoded` media type.
39pub const MEDIA_TYPE_FORM: &str = "application/x-www-form-urlencoded";