Blog Post Feedback - Intro to HTTP requests with Reqwest

I'm trying to get some teammates and dev friends interested in Rust, and I'm writing a few blog posts about how to do common, simple tasks in the language. The first one is on how to make HTTP requests with reqwest. I was hoping I could get some community feedback before I share it with any non Rust folks. I don't want to misrepresent anything or spread any incorrect info.

Any feedback is welcome!

2 Likes

Very nice and simple examples :+1:

1 Like

Nice and clear! The only things I would suggest are

  • consume the Result as you'll get a warning
  • fix typos in the description :wink:
2 Likes

What's the best way to do this, and still leave the function open to be quickly edited and reused by the reader?

Yeah... typos. I normally have someone edit my writing, but didn't this time.

Thanks for the feedback!

A couple of options:

let _ = returns_result();
// or
returns_result().unwrap(); // or expect() instead of unwrap()
2 Likes

Or a trivial match

fn main() {
    match run() {
        Ok(data) => println!("Obtained '{}'", data),
        Err(err) => eprintln!("Error '{}'", err),
    }
}

But I would just go with expect for simplicity.

1 Like

I like the use of match a lot. I'll pull that together tomorrow when I have time to make some edits.

1 Like