Skip to main content

rama_http_types/
lib.rs

1//! rama http types and minimal utilities
2//!
3//! # Rama
4//!
5//! Crate used by the end-user `rama` crate and `rama` crate authors alike.
6//!
7//! Learn more about `rama`:
8//!
9//! - Github: <https://github.com/plabayo/rama>
10//! - Book: <https://ramaproxy.org/book/>
11
12#![doc(
13    html_favicon_url = "https://raw.githubusercontent.com/plabayo/rama/main/docs/img/rama_logo.svg"
14)]
15#![doc(
16    html_logo_url = "https://raw.githubusercontent.com/plabayo/rama/main/docs/img/rama_logo.svg"
17)]
18#![cfg_attr(docsrs, feature(doc_cfg))]
19#![cfg_attr(test, allow(clippy::float_cmp))]
20
21use rama_core::extensions::Extension;
22use rama_net::uri::Uri;
23
24pub mod body;
25pub use body::{
26    Body, BodyDataStream, BodyExtractExt, BodyLimit, InfiniteReader, StreamingBody, sse,
27};
28
29pub mod request;
30pub mod response;
31
32#[macro_use]
33mod convert;
34pub mod method;
35pub mod status;
36
37mod error;
38#[doc(inline)]
39pub use crate::header::{HeaderMap, HeaderName, HeaderValue, IntoOrderedIter, OrderedIter};
40#[doc(inline)]
41pub use crate::method::Method;
42#[doc(inline)]
43pub use crate::request::{HttpRequestParts, HttpRequestPartsMut, Request};
44#[doc(inline)]
45pub use crate::response::Response;
46#[doc(inline)]
47pub use crate::status::StatusCode;
48#[doc(inline)]
49pub use error::{Error, Result};
50#[doc(inline)]
51pub use rama_net::http::Version;
52
53pub mod version {
54    //! HTTP version type, owned by `rama-net`.
55
56    #[doc(inline)]
57    pub use rama_net::http::{InvalidVersion, Version};
58}
59
60/// Hosts the per-concern `*InputExt` accessor impls for http `Request`/`Parts`.
61mod input_ext;
62pub use input_ext::protocol_from_uri_or_extensions;
63
64pub mod fingerprint;
65
66mod body_limit_layer;
67#[doc(inline)]
68pub use body_limit_layer::{BodyLimitLayer, BodyLimitService};
69
70pub mod stream {
71    //! Stream-oriented utilities layered on top of the HTTP request type.
72
73    pub mod matcher;
74}
75
76#[derive(Debug, Clone, Extension)]
77#[extension(tags(http))]
78/// Extension type that can be inserted in case a Uri is modified as part of nested routers
79pub struct OriginalRouterUri(pub Uri);
80
81pub mod proto;
82
83pub mod opentelemetry;
84
85pub mod conn;
86
87pub mod proxy;
88
89pub mod header;
90
91pub mod mime {
92    //! Re-export of the [`mime`] crate.
93    //!
94    //! Support MIME (Media Types) as strong types in Rust.
95    //!
96    //! [`mime`]: https://docs.rs/mime
97
98    #[doc(inline)]
99    pub use mime::*;
100
101    #[doc(inline)]
102    pub use mime_guess as guess;
103}