show(), hide(), visible. font-light, normal, medium, semibold, bold, extrabold, black. protocol connection pooling. fetch() with GURT. DNS from HTTP to GURT.

This commit is contained in:
Face
2025-08-18 17:45:46 +03:00
parent 3ed49fae0d
commit a8313ec3d8
38 changed files with 2123 additions and 2059 deletions

View File

@@ -1,6 +1,6 @@
use godot::prelude::*;
use gurt::prelude::*;
use gurt::{GurtMethod, GurtClientConfig};
use gurt::{GurtMethod, GurtClientConfig, GurtRequest};
use tokio::runtime::Runtime;
use std::sync::Arc;
use std::cell::RefCell;
@@ -175,21 +175,27 @@ impl GurtProtocolClient {
}
};
let url = format!("gurt://{}:{}{}", host, port, path);
let response = match runtime.block_on(async {
match method {
GurtMethod::GET => client.get(&url).await,
GurtMethod::POST => client.post(&url, "").await,
GurtMethod::PUT => client.put(&url, "").await,
GurtMethod::DELETE => client.delete(&url).await,
GurtMethod::HEAD => client.head(&url).await,
GurtMethod::OPTIONS => client.options(&url).await,
GurtMethod::PATCH => client.patch(&url, "").await,
_ => {
godot_print!("Unsupported method: {:?}", method);
return Err(GurtError::invalid_message("Unsupported method"));
}
let body = options.get("body").unwrap_or("".to_variant()).to::<String>();
let headers_dict = options.get("headers").unwrap_or(Dictionary::new().to_variant()).to::<Dictionary>();
let mut request = GurtRequest::new(method, path.to_string())
.with_header("Host", host)
.with_header("User-Agent", "GURT-Client/1.0.0");
for key_variant in headers_dict.keys_array().iter_shared() {
let key = key_variant.to::<String>();
if let Some(value_variant) = headers_dict.get(key_variant) {
let value = value_variant.to::<String>();
request = request.with_header(key, value);
}
}
if !body.is_empty() {
request = request.with_string_body(&body);
}
let response = match runtime.block_on(async {
client.send_request(host, port, request).await
}) {
Ok(resp) => resp,
Err(e) => {