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:
rusty_cookie = "0.1.2"
use Cookie;
let cookie = new
.key // The key (name) of the cookie
.value // The value of the cookie
.http_only // Make the cookie HttpOnly (cannot be accessed via JavaScript)
.same_site // Set the SameSite policy (Lax, Strict, None)
.max_age // Set the cookie's Max-Age (in seconds)
.path // Set the cookie's path to root
.properties // Set cookie's properties (Low, Medium, High)
.secure // 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 = new
.method
.path
.host
.authorization
.content_type
.content
.build;
GET / HTTP/1.1
Host: google.com
Authorization: Bearer tyuioor4r567899trtyuiop
Content-Type: text/plain
Content-Length: 14
hi billionaire
let cors = new
.allow_origin
.allow_methods
.allow_headers
.allow_credential
.max_age
.build;
println!;
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