smolhttp 1.1.0

smolhttp is a fork of the original minihttp and aims to keep simple and lightweight
Documentation

This project is a fork of the original minihttp that tries to improve the code and add more features, dont pushing aside the main purpose of the project thats is to be simple and lightweight.

Example

Sending a GET request

// Using the shortcut function
let content = smolhttp::get("https://www.rust-lang.org").unwrap().text();
println!("{content}");

// Using the Client
let content = smolhttp::Client::new("https://www.rust-lang.org").unwrap().get().send().unwrap().text();
println!("{content}");

Examples

Sending a POST request

// Using the shortcut funtion
let content = smolhttp::post("https://www.rust-lang.org").unwrap().text();
println!("{content}");

// Using the Client
let content = smolhttp::Client::new("https://www.rust-lang.org")
  .unwrap()
  .post()
  .send()
  .unwrap()
  .text();
println!("{content}");

Using custom headers

use std::collections::HashMap;
let content = smolhttp::Client::new("https://www.rust-lang.org")
  .unwrap()
  .post()
  .headers(vec![("User-Agent".to_owned(), "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36".to_owned())])
  .send()
  .unwrap()
  .text();
println!("{content}");

Using a proxy

let content = smolhttp::Client::new("http://www.google.com")
  .unwrap()
  .proxy("http://127.0.0.1:1080")
  .unwrap()
  .get()
  .send()
  .unwrap()
  .text();
println!("{content}");