5.0.1 update
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// Тест новых FastAPI функций
|
||||
include("src/net.fox");
|
||||
|
||||
void test_server_functions() {
|
||||
print("🧪 Testing FastAPI functions...");
|
||||
|
||||
// Тест запуска сервера
|
||||
string start_result = server_start(8080);
|
||||
print("Server start: " + start_result);
|
||||
|
||||
// Тест регистрации маршрутов
|
||||
string get_route = route_get("/test", "test_handler");
|
||||
print("GET route: " + get_route);
|
||||
|
||||
string post_route = route_post("/api", "api_handler");
|
||||
print("POST route: " + post_route);
|
||||
|
||||
// Тест отправки ответа
|
||||
send_response("{\"message\":\"Hello from FoxLang!\"}");
|
||||
|
||||
// Остановка сервера
|
||||
string stop_result = server_stop();
|
||||
print("Server stop: " + stop_result);
|
||||
|
||||
print("✅ FastAPI functions test completed!");
|
||||
}
|
||||
|
||||
test_server_functions();
|
||||
@@ -0,0 +1,36 @@
|
||||
// Тест всех HTTP запросов в FoxLang
|
||||
|
||||
void test_http_requests() {
|
||||
print("🌐 Testing HTTP requests in FoxLang");
|
||||
print("===================================");
|
||||
|
||||
// GET запрос
|
||||
print("📥 GET request:");
|
||||
string get_response = httpget("https://httpbin.org/get");
|
||||
print("Response: " + get_response);
|
||||
print("");
|
||||
|
||||
// POST запрос
|
||||
print("📤 POST request:");
|
||||
string post_data = "{\"name\":\"FoxLang\",\"version\":\"5.0.1\"}";
|
||||
string post_response = httppost("https://httpbin.org/post", post_data);
|
||||
print("Response: " + post_response);
|
||||
print("");
|
||||
|
||||
// PUT запрос
|
||||
print("🔄 PUT request:");
|
||||
string put_data = "{\"updated\":\"true\"}";
|
||||
string put_response = httpput("https://httpbin.org/put", put_data);
|
||||
print("Response: " + put_response);
|
||||
print("");
|
||||
|
||||
// DELETE запрос
|
||||
print("🗑️ DELETE request:");
|
||||
string delete_response = httpdelete("https://httpbin.org/delete");
|
||||
print("Response: " + delete_response);
|
||||
print("");
|
||||
|
||||
print("✅ All HTTP methods tested!");
|
||||
}
|
||||
|
||||
test_http_requests();
|
||||
Reference in New Issue
Block a user