rowrap 0.0.0

A wrapper for the Roblox API.
Documentation
use anyhow::{Error, anyhow};
use reqwest::{
    Client,
    header::{
        COOKIE,
        CONTENT_LENGTH,
    },
};

pub async fn generate_xcsrf(cookie: &String) -> Result<String, Error> {
    let client = Client::new();

    let response = client
        .post("https://auth.roblox.com/v2/logout")
        .header(COOKIE, format!(".ROBLOSECURITY={cookie};"))
        .header(CONTENT_LENGTH, "0")
        .send()
        .await?;

    let xcsrf = response
        .headers()
        .get("x-csrf-token")
        .ok_or_else(|| anyhow!("Invalid .ROBLOSECURITY Cookie, X-CSRF-TOKEN was not found in the header returned by the request to the url https://auth.roblox.com/v2/logout"))?
        .to_str()?
        .to_owned();

    Ok(xcsrf)
}