rustysozluk/http_client.rs
1//! # RustySozluk HTTP Client
2//!
3//! `rustysozluk_http_client` is a module responsible for making HTTP requests to fetch web pages.
4
5use reqwest::Error;
6
7/// Fetches the content of a web page.
8///
9/// # Arguments
10///
11/// * `url` - A `&str` that defines the URL of the web page to fetch.
12///
13/// # Returns
14///
15/// A `Result` which is either:
16/// * `Ok(String)` - A `String` containing the HTML content of the web page.
17/// * `Err(Error)` - An error of type `reqwest::Error`.
18pub async fn fetch_page(url: &str) -> Result<String, Error> {
19 let response = reqwest::get(url).await?;
20 let body = response.text().await?;
21 Ok(body)
22}