From 2128a958a4482c12382ca461486a68691b3d813a Mon Sep 17 00:00:00 2001 From: adnanjpg Date: Sun, 3 Mar 2024 11:21:46 +0300 Subject: [PATCH] refactor: #4 pr review --- a.sh | 1 - src/client/mod.rs | 7 +------ src/message/tests.rs | 11 ----------- 3 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 a.sh diff --git a/a.sh b/a.sh deleted file mode 100644 index 5d89ab970..000000000 --- a/a.sh +++ /dev/null @@ -1 +0,0 @@ -cargo run --example simple_sender -- -t fP0EXs_HQ4Gj1sE5xBP6LP:APA91bGxDOk4GzvIvvGFPa6kDWOOHm2zYA3tUN1jYwErSBq_s27NioYjYWfUpgUW3_LIsreSw1pbtTjEpCK_cKR6AHxo1PGZ1Yd3S8lyX148I_LgKaTNYorG2QtkcwfB9Nm5yKGJwLaG \ No newline at end of file diff --git a/src/client/mod.rs b/src/client/mod.rs index ff58cad37..f2418fa87 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -109,7 +109,7 @@ impl Client { Err(err) => return Err(err.to_string()), }; - let token_no_bearer = access_token.split(" ").collect::>()[1]; + let token_no_bearer = access_token.split(char::is_whitespace).collect::>()[1]; Ok(token_no_bearer.to_string()) } @@ -140,11 +140,6 @@ impl Client { .body(Body::from(payload)) .build()?; - // print the body - let body = request.body().unwrap(); - let body = std::str::from_utf8(body.as_bytes().unwrap()).unwrap(); - println!("body: {}", body); - let response = self.http_client.execute(request).await?; let response_status = response.status(); diff --git a/src/message/tests.rs b/src/message/tests.rs index 143ec9edc..8cb9fb713 100644 --- a/src/message/tests.rs +++ b/src/message/tests.rs @@ -161,17 +161,6 @@ fn should_be_able_to_render_a_full_condition_message_to_json() { #[test] fn should_set_notifications() { let target = Target::Token("token".to_string()); - let msg = Message { - target: target.clone(), - data: None, - notification: None, - android: None, - webpush: None, - apns: None, - fcm_options: None, - }; - - assert_eq!(msg.notification.is_none(), true); let nm = Notification { title: None,