mas_http/
lib.rs

1// Copyright 2022 The Matrix.org Foundation C.I.C.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! [`tower`] layers and services to help building HTTP client and servers
16
17#![deny(rustdoc::missing_crate_level_docs)]
18#![allow(clippy::module_name_repetitions)]
19
20#[cfg(feature = "client")]
21mod client;
22mod ext;
23mod layers;
24mod service;
25
26#[cfg(feature = "client")]
27pub use self::{
28    client::{
29        make_traced_connector, make_untraced_client, Client, TracedClient, TracedConnector,
30        UntracedClient, UntracedConnector,
31    },
32    layers::client::{ClientLayer, ClientService},
33};
34pub use self::{
35    ext::{set_propagator, CorsLayerExt, ServiceExt as HttpServiceExt},
36    layers::{
37        body_to_bytes_response::{self, BodyToBytesResponse, BodyToBytesResponseLayer},
38        bytes_to_body_request::{self, BytesToBodyRequest, BytesToBodyRequestLayer},
39        catch_http_codes::{self, CatchHttpCodes, CatchHttpCodesLayer},
40        form_urlencoded_request::{self, FormUrlencodedRequest, FormUrlencodedRequestLayer},
41        json_request::{self, JsonRequest, JsonRequestLayer},
42        json_response::{self, JsonResponse, JsonResponseLayer},
43    },
44    service::{BoxCloneSyncService, HttpService},
45};
46
47pub type EmptyBody = http_body_util::Empty<bytes::Bytes>;