This is an automated email from the ASF dual-hosted git repository.

katarina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mnemonic.git


The following commit(s) were added to refs/heads/master by this push:
     new 479a8fc  MNEMONIC-803: Enhanced Rust HTTP Client Code with Improved 
Error Handling and Readability
     new 4434c46  Merge pull request #363 from katarinaking/803
479a8fc is described below

commit 479a8fca5d9400cd066926aaeb407ad35a281ea7
Author: Katarina <[email protected]>
AuthorDate: Sun Dec 17 02:59:53 2023 +0000

    MNEMONIC-803: Enhanced Rust HTTP Client Code with Improved Error Handling 
and Readability
---
 mnemonic-protocol/client/src/main.rs | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/mnemonic-protocol/client/src/main.rs 
b/mnemonic-protocol/client/src/main.rs
index 8447320..c87cffa 100644
--- a/mnemonic-protocol/client/src/main.rs
+++ b/mnemonic-protocol/client/src/main.rs
@@ -15,8 +15,10 @@
 // specific language governing permissions and limitations
 // under the License.
 
+// Import necessary libraries
 use reqwest;
 
+// Main asynchronous function
 #[tokio::main]
 async fn main() -> Result<(), reqwest::Error> {
     // The URL of the server you want to visit
@@ -32,8 +34,16 @@ async fn main() -> Result<(), reqwest::Error> {
         println!("Response body:\n{}", body);
     } else {
         // Print the status code and reason phrase for unsuccessful requests
-        println!("Request failed with status: {} - {}", response.status(), 
response.status().canonical_reason().unwrap_or("Unknown"));
+        println!(
+            "Request failed with status: {} - {}",
+            response.status(),
+            response
+                .status()
+                .canonical_reason()
+                .unwrap_or("Unknown")
+        );
     }
 
+    // Return Ok to indicate success
     Ok(())
 }

Reply via email to