DEV Community

El Bruno for Microsoft Azure

Posted on • Originally published at on

#Rust πŸ¦€ – Learning HTTP GET and POST requests in Rust, and yes this is a β€œπŸŒWhat’s my IP” demo πŸ˜„

Hi !

Yes, I’m starting to use OpenAI services in with Rust. However, before getting here, I spent some time learning how to work with HTTP Requests in Rust.

There seems to be several libraries that can help. I found several examples using [], so I decided to use this one.

A classic example to do this, is to perform an HTTP GET request to the following url, to get our public IP Address.

Enter fullscreen mode Exit fullscreen mode

And hey, the code is super simple

With a more simple output

    Finished dev [unoptimized + debuginfo] target(s) in 3.99s
     Running `target\debug\result02.exe`
    "origin": "",

Enter fullscreen mode Exit fullscreen mode

More about http calls in next posts!

Happy coding!


El Bruno

More posts in my blog

Top comments (0)