1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-31 09:24:31 +03:00

Simplify the HTTP client building

Also supports loading the WebPKI roots instead of the native ones for
TLS
This commit is contained in:
Quentin Gliech
2022-09-15 16:00:33 +02:00
parent a663deb7e1
commit 7b819ffa8b
10 changed files with 216 additions and 148 deletions

View File

@ -34,7 +34,7 @@ opentelemetry-zipkin = { version = "0.15.0", features = ["reqwest-client", "reqw
mas-config = { path = "../config" }
mas-email = { path = "../email" }
mas-handlers = { path = "../handlers" }
mas-handlers = { path = "../handlers", default-features = false }
mas-http = { path = "../http", features = ["axum"] }
mas-policy = { path = "../policy" }
mas-router = { path = "../router" }
@ -47,8 +47,16 @@ mas-templates = { path = "../templates" }
indoc = "1.0.7"
[features]
default = ["otlp", "jaeger", "zipkin"]
default = ["otlp", "jaeger", "zipkin", "native-roots"]
# Use the native root certificates
native-roots = ["mas-http/native-roots", "mas-handlers/native-roots"]
# Use the webpki root certificates
webpki-roots = ["mas-http/webpki-roots", "mas-handlers/webpki-roots"]
# Read the builtin static files and templates from the source directory
dev = ["mas-templates/dev", "mas-static-files/dev"]
# Enable OpenTelemetry OTLP exporter. Requires "protoc"
otlp = ["opentelemetry-otlp"]
# Enable OpenTelemetry Jaeger exporter and propagator.

View File

@ -72,7 +72,7 @@ impl Options {
json: false,
url,
} => {
let mut client = mas_http::client("cli-debug-http");
let mut client = mas_http::client("cli-debug-http").await?;
let request = hyper::Request::builder()
.uri(url)
.body(hyper::Body::empty())?;
@ -97,6 +97,7 @@ impl Options {
url,
} => {
let mut client = mas_http::client("cli-debug-http")
.await?
.response_body_to_bytes()
.json_response();
let request = hyper::Request::builder()