diff --git a/crates/infisical/src/api/auth/mod.rs b/crates/infisical/src/api/auth/mod.rs index 33be712..3fd1909 100644 --- a/crates/infisical/src/api/auth/mod.rs +++ b/crates/infisical/src/api/auth/mod.rs @@ -48,11 +48,7 @@ pub(self) async fn auth_infisical_google( jwt: Option, ) -> Result { let url = format!("{}/api/v1/auth/gcp-auth/login", client.site_url.clone()); - let request_client = build_base_request(client, &url, reqwest::Method::POST).await?; - - let request = request_client - .header(reqwest::header::ACCEPT, "application/json") - .header(reqwest::header::USER_AGENT, client.user_agent.clone()); + let request = build_base_request(client, &url, reqwest::Method::POST).await?; let mut body = HashMap::new(); body.insert("identityId", identity_id); @@ -69,11 +65,7 @@ pub(self) async fn auth_infisical_azure( jwt: Option, ) -> Result { let url = format!("{}/api/v1/auth/azure-auth/login", client.site_url.clone()); - let request_client = build_base_request(client, &url, reqwest::Method::POST).await?; - - let request = request_client - .header(reqwest::header::ACCEPT, "application/json") - .header(reqwest::header::USER_AGENT, client.user_agent.clone()); + let request = build_base_request(client, &url, reqwest::Method::POST).await?; let mut body = HashMap::new(); body.insert("identityId", identity_id); @@ -93,11 +85,7 @@ pub(self) async fn auth_infisical_kubernetes( "{}/api/v1/auth/kubernetes-auth/login", client.site_url.clone() ); - let request_client = build_base_request(client, &url, reqwest::Method::POST).await?; - - let request = request_client - .header(reqwest::header::ACCEPT, "application/json") - .header(reqwest::header::USER_AGENT, client.user_agent.clone()); + let request = build_base_request(client, &url, reqwest::Method::POST).await?; let mut body = HashMap::new(); body.insert("identityId", identity_id); @@ -123,7 +111,7 @@ pub(self) async fn auth_infisical_aws( let request_body = base64_encode(iam_data.iam_request_body.clone()); let url = format!("{}/api/v1/auth/aws-auth/login", client.site_url.clone()); - let request_client = build_base_request(client, &url, reqwest::Method::POST).await?; + let request = build_base_request(client, &url, reqwest::Method::POST).await?; let mut form_data = HashMap::new(); @@ -132,10 +120,6 @@ pub(self) async fn auth_infisical_aws( form_data.insert("iamRequestBody", Some(request_body)); form_data.insert("iamRequestHeaders", Some(iam_headers)); - let request = request_client - .header(reqwest::header::ACCEPT, "application/json") - .header(reqwest::header::USER_AGENT, client.user_agent.clone()); - let response = request.form(&form_data).send().await?; return Ok(response); diff --git a/crates/infisical/src/api/auth/universal_auth_login.rs b/crates/infisical/src/api/auth/universal_auth_login.rs index 3c046d7..39e0083 100644 --- a/crates/infisical/src/api/auth/universal_auth_login.rs +++ b/crates/infisical/src/api/auth/universal_auth_login.rs @@ -24,12 +24,7 @@ pub async fn universal_auth_login( client.site_url.clone() ); - let request_client = build_base_request(client, &url, reqwest::Method::POST).await?; - - let request = request_client - .header(reqwest::header::CONTENT_TYPE, "application/json") - .header(reqwest::header::ACCEPT, "application/json") - .header(reqwest::header::USER_AGENT, client.user_agent.clone()); + let request = build_base_request(client, &url, reqwest::Method::POST).await?; let response = request.body(request_body).send().await?; diff --git a/crates/infisical/src/helper.rs b/crates/infisical/src/helper.rs index fa24cb7..99d04e0 100644 --- a/crates/infisical/src/helper.rs +++ b/crates/infisical/src/helper.rs @@ -251,7 +251,7 @@ pub async fn build_base_request( // Setting JSON as the content type is OK since we only work with JSON. .header(reqwest::header::CONTENT_TYPE, "application/json") .header(reqwest::header::ACCEPT, "application/json") - .header("Authorization", token) + .header(reqwest::header::AUTHORIZATION, token) .header(reqwest::header::USER_AGENT, client.user_agent.clone()); Ok(base_request)