From 998967f61bf0c85b5af3c71ac96b21c93539b857 Mon Sep 17 00:00:00 2001 From: Jan <59206115+Threated@users.noreply.github.com> Date: Sun, 28 Jul 2024 09:44:44 +0200 Subject: [PATCH] chore: upgrade reqwest to 0.12 and remove direct deb of http (#159) --- Cargo.toml | 3 +-- src/beam.rs | 2 +- src/blaze.rs | 2 +- src/config.rs | 16 ++++++++-------- src/errors.rs | 3 ++- src/exporter.rs | 5 +---- src/intermediate_rep.rs | 5 +---- 7 files changed, 15 insertions(+), 21 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1d109df..ee17b0b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,7 @@ license = "Apache-2.0" [dependencies] base64 = "0.22.1" -http = "0.2" -reqwest = { version = "0.11", default-features = false, features = ["json", "default-tls"] } +reqwest = { version = "0.12", default-features = false, features = ["json", "default-tls"] } serde = { version = "1.0.152", features = ["serde_derive"] } serde_json = "1.0" thiserror = "1.0.38" diff --git a/src/beam.rs b/src/beam.rs index 9c2f3c6..45a640e 100644 --- a/src/beam.rs +++ b/src/beam.rs @@ -1,7 +1,7 @@ use std::time::Duration; use beam_lib::{TaskResult, BeamClient, BlockingOptions, MsgId, TaskRequest, RawString}; -use http::StatusCode; +use reqwest::StatusCode; use once_cell::sync::Lazy; use serde::Serialize; use tracing::{debug, warn, info}; diff --git a/src/blaze.rs b/src/blaze.rs index 02162e1..18aa63c 100644 --- a/src/blaze.rs +++ b/src/blaze.rs @@ -1,4 +1,4 @@ -use http::StatusCode; +use reqwest::StatusCode; use serde::Deserialize; use serde::Serialize; use serde_json::Value; diff --git a/src/config.rs b/src/config.rs index 1498943..7a09748 100644 --- a/src/config.rs +++ b/src/config.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; use beam_lib::AppId; use clap::Parser; -use http::{HeaderValue, Uri}; +use reqwest::{header::HeaderValue, Url}; use once_cell::sync::Lazy; use reqwest::{Certificate, Client, Proxy}; use tracing::{debug, info, warn}; @@ -55,7 +55,7 @@ const CLAP_FOOTER: &str = "For proxy support, environment variables HTTP_PROXY, struct CliArgs { /// The beam proxy's base URL, e.g. https://proxy1.beam.samply.de #[clap(long, env, value_parser)] - beam_proxy_url: Uri, + beam_proxy_url: Url, /// This application's beam AppId, e.g. focus.proxy1.broker.samply.de #[clap(long, env, value_parser)] @@ -71,15 +71,15 @@ struct CliArgs { /// The endpoint base URL, e.g. https://blaze.site/fhir/ #[clap(long, env, value_parser)] - endpoint_url: Option, + endpoint_url: Option, /// The endpoint base URL, e.g. https://blaze.site/fhir/, for the sake of backward compatibility, use endpoint_url instead #[clap(long, env, value_parser)] - blaze_url: Option, + blaze_url: Option, /// The exporter URL, e.g. https://exporter.site/ #[clap(long, env, value_parser)] - exporter_url: Option, + exporter_url: Option, /// Type of the endpoint, e.g. "blaze", "omop" #[clap(long, env, value_parser = clap::value_parser!(EndpointType), default_value = "blaze")] @@ -164,12 +164,12 @@ struct CliArgs { } pub(crate) struct Config { - pub beam_proxy_url: Uri, + pub beam_proxy_url: Url, pub beam_app_id_long: AppId, pub api_key: String, pub retry_count: usize, - pub endpoint_url: Uri, - pub exporter_url: Option, + pub endpoint_url: Url, + pub exporter_url: Option, pub endpoint_type: EndpointType, pub obfuscate: Obfuscate, pub obfuscate_zero: bool, diff --git a/src/errors.rs b/src/errors.rs index d01059d..8cccda1 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,3 +1,4 @@ +use reqwest::header; use thiserror::Error; #[derive(Error, Debug)] @@ -55,7 +56,7 @@ pub enum FocusError { #[error("Invalid date format: {0}")] AstInvalidDateFormat(String), #[error("Invalid Header Value: {0}")] - InvalidHeaderValue(http::header::InvalidHeaderValue), + InvalidHeaderValue(header::InvalidHeaderValue), #[error("Missing Exporter Endpoint")] MissingExporterEndpoint, #[error("Missing Exporter Task Type")] diff --git a/src/exporter.rs b/src/exporter.rs index fb18e68..c3eb932 100644 --- a/src/exporter.rs +++ b/src/exporter.rs @@ -1,7 +1,4 @@ -use http::header; -use http::HeaderMap; -use http::HeaderValue; -use http::StatusCode; +use reqwest::{header::{self, HeaderMap, HeaderValue}, StatusCode}; use serde::Deserialize; use serde::Serialize; use serde_json::Value; diff --git a/src/intermediate_rep.rs b/src/intermediate_rep.rs index 6ac1210..5026aa3 100644 --- a/src/intermediate_rep.rs +++ b/src/intermediate_rep.rs @@ -1,7 +1,4 @@ -use http::header; -use http::HeaderMap; -use http::HeaderValue; -use http::StatusCode; +use reqwest::{header::{self, HeaderMap, HeaderValue}, StatusCode}; use serde::Deserialize; use serde::Serialize; use tracing::{debug, warn};