http-query 0.2.0

A client and server SDK for the HTTP QUERY method (RFC 10008).
Documentation
//! Method token, header field names and media types for the QUERY method.

use http::Method;
use std::sync::LazyLock;

/// The HTTP QUERY method token, as defined by RFC 10008.
pub const METHOD_QUERY: &str = "QUERY";

/// The default maximum number of redirects a [`crate::Client`] follows.
pub const DEFAULT_MAX_REDIRECTS: usize = 10;

static QUERY_METHOD: LazyLock<Method> =
    LazyLock::new(|| Method::from_bytes(b"QUERY").expect("QUERY is a valid method token"));

/// Returns the [`http::Method`] value for QUERY.
///
/// This works regardless of whether the linked `http` version predates the
/// built-in `Method::QUERY` constant.
pub fn query_method() -> Method {
    QUERY_METHOD.clone()
}

/// The `Accept-Query` header field name (RFC 10008 ยง3).
pub const HEADER_ACCEPT_QUERY: &str = "accept-query";
/// The `Allow` header field name.
pub const HEADER_ALLOW: &str = "allow";
/// The `Content-Type` header field name.
pub const HEADER_CONTENT_TYPE: &str = "content-type";
/// The `Content-Location` header field name.
pub const HEADER_CONTENT_LOCATION: &str = "content-location";
/// The `Location` header field name.
pub const HEADER_LOCATION: &str = "location";
/// The `Accept` header field name.
pub const HEADER_ACCEPT: &str = "accept";

/// The `application/json` media type.
pub const MEDIA_TYPE_JSON: &str = "application/json";
/// The `application/x-www-form-urlencoded` media type.
pub const MEDIA_TYPE_FORM: &str = "application/x-www-form-urlencoded";