One of my favorite things about your videos is that you introduce us to various related tools. I didn't know about Mockoon and was having trouble setting up a proxy to avoid repeatedly hitting a production server. Thank you for sharing your knowledge with us.
@TrevorSullivan Жыл бұрын
Thank you!! 🙂 I'm glad you are discovering new tools! Mockoon is pretty helpful, right?
@ihgnmah Жыл бұрын
@@TrevorSullivan Yeah, its UX and DX are awesome.
@jmeumeu Жыл бұрын
One thing to keep in mind, is that even if the response is Ok(....), it does not mean that you have a 200 status code. So you probably want to check that response.status() is equal to reqwest::StatusCode::OK
@dooterino10 ай бұрын
response.status().is_success() would probably be a better route, it returns true for all values 200-299 which may be leveraged by an API for alternate success indicators
@Aras14 Жыл бұрын
A better way to do the check for error/ok is to do a match statement: match http_result { Ok(res) => { //Handling the response }, Err(err) => { //Handling the error } } That way you avoid using unwrap so much, which in my opinion looks better, is easily readable and helps reduce panics. Edit: It also might be a little more performant. Edit2: A good place to use unwrap here is on the client builder, since your program can't work without it. If it fails it shouldn't run.
@foofighterdaz Жыл бұрын
Thanks for this comment. Great to compare the two approaches.
@judevectorАй бұрын
Man you singlehandedly helped me learn Rust . I know have a lot of knowledge that what i know last month . Thanks alot ❤
@firstname-lastname3 ай бұрын
Your Rust videos are simply the best from the best, thank you!
@farzadmf Жыл бұрын
Thank you for the video, and all the videos honestly; I LOVE how you walk through the steps, not skipping any. Very nice job One question: you said you're running Rust programs on you Linux box (and I see VSCode is ssh-ing); does it mean that you're running mockoon remotely as well?
@TrevorSullivan Жыл бұрын
Thanks so much for your kind comment!! Mockoon is running locally on my Windows 11 system. That's why I had to use it's mDNS name to connect to it remotely from the Rust code on the Linux VM. I hope this makes sense! Great question! By the way, I have another video series on LXD, which is what I use to launch Linux virtual machines for self-hosting and development purposes. You might be interested in that! 🙂
@farzadmf Жыл бұрын
@@TrevorSullivan will definitely check out the video. I personally use SSH port forwarding for these kinds of use cases. Don't know how to set up mDNS (honestly, had to Google it because didn't have any idea what it is 😆)
@TrevorSullivan Жыл бұрын
@@farzadmf mDNS is just an easy way to resolve hostnames on a small network. It uses multicast, so you don't have to set up a dedicated DNS server. It's convenient, but has some limitations. You shouldn't need to use SSH forwarding since the VSCode remote extension will handle the SSH connection for you. Maybe I'm missing some details in your setup though. Rust on! 🦀🙂
@farzadmf Жыл бұрын
@@TrevorSullivan Rust on indeed 😆 As for SSH port-forwarding, my use case is maybe the other way around: a client on my local machine needs to access a server running on my remote SSH server; that's where I use port forwarding to accomplish that TBH, I've been what I call a "Rust watcher" for a long time, but your tutorials are so well done that encourage me to actually do something with Rust 😉 One personal suggestion: it would be nice to start "putting things into practice" and create some project-based series; I'd personally love that/those 🙂
@TrevorSullivan Жыл бұрын
@@farzadmf oh that makes sense! Using SSH as a transport security layer is excellent for accessing remote services! Thank you for your comment about my videos! I needed a push myself as well, since I'm not accustomed to working with low-level languages. Rust has really bridged the gap though, and I'm excited to learn about it! Project based videos are a great idea as well! I'll eventually get to something like that, where we "assemble all the pieces" and make a useful application. At the moment, I'm trying to take small bites before I dive too far into a whole app. 🙂
@raph384 Жыл бұрын
best rust tutos i've ever seen really
@TrevorSullivan Жыл бұрын
That's very kind of you, thank you
@raph384 Жыл бұрын
but what is your vs code theme? i like the colors@@TrevorSullivan
@TrevorSullivan Жыл бұрын
@@raph384 it's the outrun theme by samrapdev
@xE92vD Жыл бұрын
Thanks. The additional crates you provided (especially mackoon) were very helpful.
@symshark Жыл бұрын
This tutorial came just in time. I wasn't familiar with Mockoon but I will be using it going forward to test scripts, thanks!
@TrevorSullivan Жыл бұрын
It's a great tool! 🙂 Rust on!! 🦀
@RichardWalterLanda7 ай бұрын
top! thnaks yu mate for what yu are doing. I think yu deserve much more attention of rust community! wish yu a good luck
@TrevorSullivan7 ай бұрын
Thank you, Richard! I appreciate you being part of the community! I'm glad that you're learning from these videos. That's why I produce them. 🦀🦀
@hectorrios14329 ай бұрын
Great video, thank you! Very clear and easy to follow, which is what we need more of when trying to learn Rust.
@dancostello29 ай бұрын
This was a great tutorial - thank you!
@xieen79769 ай бұрын
can you do a example of stream post and handle chunked json response?
@alexbrun6863 Жыл бұрын
absolute legend
@DESCARTINPHILLIPLANCEB Жыл бұрын
Hi Trevor, thank you for providing this tutorial. By the way, may I ask you a question? How did you fix that TLS error of OpenSSL and pkgconf? Thank you.
@TrevorSullivan Жыл бұрын
Hello! I installed libssl-dev and pkg-config with the apt package manager!
@DESCARTINPHILLIPLANCEB Жыл бұрын
@@TrevorSullivanThank you for your response sir.
@LexComments Жыл бұрын
Why not using a proper HTTP mock library instead of Mockoon? In any case, you want to have your tests automated to make sure there are no breaking changes in the future. I don't see how this can be achieved with Mockoon.
@CrapE_DM4 ай бұрын
Why are you using ok() before all of your unwrap()s? Result has its own unwrap().
@TrevorSullivan4 ай бұрын
Yeah I must not have realized that earlier on. These days I have a better understanding of working with Result.