clienter 0.1.2

A simple, lightweight, zero dependency, HTTP client for Rust
Documentation
  • Coverage
  • 94.9%
    93 out of 98 items documented6 out of 6 items with examples
  • Size
  • Source code size: 54.57 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.87 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • sanchez/clienter
    0 0 2
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • sanchez

Clienter

Clienter is a project designed to manage client interactions and data efficiently. This README provides an overview of the project, how to set it up, and how to contribute.

Table of Contents

Installation

To install the project, follow these steps:

  1. Clone the repository:
    git clone https://github.com/yourusername/clienter.git
    
  2. Navigate to the project directory:
    cd clienter
    
  3. Build the project:
    cargo build
    

Usage

To run the project, use:

cargo run

To run the tests:

cargo test

Examples

Here are some examples of how to use the clienter library:

Simple GET Request

use clienter::{HttpClient, HttpMethod};

fn main() {
    let client = HttpClient::new();
    let request = client.request(HttpMethod::GET, "http://httpbin.org/anything");
    let mut response = client.send(&request).unwrap();
    println!("Status: {}", response.status);
    let body = response.body_as_string().unwrap();
    println!("Body: {}", body);
}

POST Request with JSON Body

use clienter::{HttpClient, HttpMethod, HttpRequest};

fn main() {
    let client = HttpClient::new();
    let mut request = client.request(HttpMethod::POST, "http://httpbin.org/post");
    request.set_body(r#"{"key": "value"}"#);
    let mut response = client.send(&request).unwrap();
    println!("Status: {}", response.status);
    let body = response.body_as_string().unwrap();
    println!("Body: {}", body);
}

License

This project is licensed under the MIT License. See the LICENSE file for details.