Fix
This commit is contained in:
+6
-6
@@ -13,13 +13,13 @@ impl SendMsg {
|
|||||||
auth_token: &str,
|
auth_token: &str,
|
||||||
phone_number: &str,
|
phone_number: &str,
|
||||||
service_sid: &str,
|
service_sid: &str,
|
||||||
auth_sid: &str,
|
account_sid: &str,
|
||||||
) {
|
) {
|
||||||
self.config = VendorConfig {
|
self.config = VendorConfig {
|
||||||
auth_token: auth_token.to_string(),
|
auth_token: auth_token.to_string(),
|
||||||
phone_number: phone_number.to_string(),
|
phone_number: phone_number.to_string(),
|
||||||
service_sid: service_sid.to_string(),
|
service_sid: service_sid.to_string(),
|
||||||
auth_sid: auth_sid.to_string(),
|
account_sid: account_sid.to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ impl SendMsg {
|
|||||||
} else if self.config.phone_number.is_empty()
|
} else if self.config.phone_number.is_empty()
|
||||||
|| self.config.service_sid.is_empty()
|
|| self.config.service_sid.is_empty()
|
||||||
|| self.config.auth_token.is_empty()
|
|| self.config.auth_token.is_empty()
|
||||||
|| self.config.auth_sid.is_empty()
|
|| self.config.account_sid.is_empty()
|
||||||
{
|
{
|
||||||
Err(std::io::Error::other("Config not populated"))
|
Err(std::io::Error::other("Config not populated"))
|
||||||
} else {
|
} else {
|
||||||
@@ -57,9 +57,9 @@ impl SendMsg {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let url = twilio::api::twilio_url(&self.config.auth_sid);
|
let url = twilio::api::twilio_url(&self.config.account_sid);
|
||||||
let headers =
|
let headers =
|
||||||
match twilio::api::init_headers(&self.config.auth_sid, &self.config.auth_token) {
|
match twilio::api::init_headers(&self.config.account_sid, &self.config.auth_token) {
|
||||||
Ok(headers) => headers,
|
Ok(headers) => headers,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
return Err(std::io::Error::other(err));
|
return Err(std::io::Error::other(err));
|
||||||
@@ -91,7 +91,7 @@ pub struct VendorConfig {
|
|||||||
pub auth_token: String,
|
pub auth_token: String,
|
||||||
pub phone_number: String,
|
pub phone_number: String,
|
||||||
pub service_sid: String,
|
pub service_sid: String,
|
||||||
pub auth_sid: String,
|
pub account_sid: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ pub fn init_headers(
|
|||||||
};
|
};
|
||||||
headers.insert(
|
headers.insert(
|
||||||
"Authorization",
|
"Authorization",
|
||||||
match auth.parse() {
|
match format!("Basic {auth}").parse() {
|
||||||
Ok(auth) => auth,
|
Ok(auth) => auth,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
return Err(std::io::Error::other(err));
|
return Err(std::io::Error::other(err));
|
||||||
|
|||||||
Reference in New Issue
Block a user