rusty-format 0.1.4

rusty_format is a Rust crate that provides a simple and flexible way to create, manage, and handle cookies and client
Documentation
  • Coverage
  • 0%
    0 out of 97 items documented0 out of 57 items with examples
  • Size
  • Source code size: 37.01 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 7.3 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • HashiramaSenjuhari

Rusty Format Crate

rusty_format is a Rust crate that provides a simple and flexible way to create response used for http request .

Installation

To use rusty_cookie in your project, add the following dependency in your Cargo.toml:


  [dependencies]
  rusty_cookie = "0.1.2"

  use rusty_cookie::Cookie;

  let cookie = Cookie::new()
      .key("secure_code")                          // The key (name) of the cookie
      .value("rt8uygyiuiouhopijuhu8yu8ui")         // The value of the cookie
      .http_only(true)                             // Make the cookie HttpOnly (cannot be accessed via JavaScript)
      .same_site(SameSite::Lax)                    // Set the SameSite policy (Lax, Strict, None)
      .max_age(3600)                               // Set the cookie's Max-Age (in seconds)
      .path("/")                                   // Set the cookie's path to root
      .properties(Properties::High)                // Set cookie's properties (Low, Medium, High)
      .secure(true)                                // Mark the cookie as secure (sent only over HTTPS)
      .build();                                    // Build the cookie
  Set-Cookie: secure_code=rt8uygyiuiouhopijuhu8yu8ui; HttpOnly; SameSite=Lax; Secure; Path=/; Max-Age=3600; Priority=High;
        let response = ClientResponse::new()
    .method("GET")
    .path("/")
    .host("google.com")
    .authorization("Bearer tyuioor4r567899trtyuiop")
    .content_type(rusty_cookie::ContentType::TextPlain)
    .content("hi billionaire")
    .build();

  GET / HTTP/1.1
  Host: google.com
  Authorization: Bearer tyuioor4r567899trtyuiop
  Content-Type: text/plain
  Content-Length: 14

  hi billionaire
    let cors = Cors::new()
        .allow_origin("*")
        .allow_methods(&["GET", "POST"])
        .allow_headers(&["Content-Type"])
        .allow_credential(true)
        .max_age(6000)
        .build();
    println!("{}", cors);
  Access-Control-Allow-Origin: *
  Access-Control-Allow-Methods: GET,POST
  Access-Control-Allow-Headers: Content-Type
  Access-Control-Allow-Credentials: true
  Access-Control-Max-Age: 6000