Complete HTTP server infrastructure integration and test basic functionality

Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-08-14 06:20:45 +00:00
parent 212b46825f
commit 004b6b7953
2 changed files with 114 additions and 268 deletions

View File

@ -7,7 +7,7 @@
*/
use super::*;
use crate::boxes::{NullBox, ConsoleBox, FloatBox, DateTimeBox};
use crate::boxes::{NullBox, ConsoleBox, FloatBox, DateTimeBox, SocketBox, HTTPServerBox, HTTPRequestBox, HTTPResponseBox};
// use crate::boxes::intent_box_wrapper::IntentBoxWrapper;
use std::sync::Arc;
@ -607,6 +607,46 @@ impl NyashInterpreter {
});
}
}
"SocketBox" => {
// SocketBoxは引数なしで作成
if !arguments.is_empty() {
return Err(RuntimeError::InvalidOperation {
message: format!("SocketBox constructor expects 0 arguments, got {}", arguments.len()),
});
}
let socket_box = Box::new(SocketBox::new()) as Box<dyn NyashBox>;
return Ok(socket_box);
}
"HTTPServerBox" => {
// HTTPServerBoxは引数なしで作成
if !arguments.is_empty() {
return Err(RuntimeError::InvalidOperation {
message: format!("HTTPServerBox constructor expects 0 arguments, got {}", arguments.len()),
});
}
let http_server_box = Box::new(HTTPServerBox::new()) as Box<dyn NyashBox>;
return Ok(http_server_box);
}
"HTTPRequestBox" => {
// HTTPRequestBoxは引数なしで作成
if !arguments.is_empty() {
return Err(RuntimeError::InvalidOperation {
message: format!("HTTPRequestBox constructor expects 0 arguments, got {}", arguments.len()),
});
}
let http_request_box = Box::new(HTTPRequestBox::new()) as Box<dyn NyashBox>;
return Ok(http_request_box);
}
"HTTPResponseBox" => {
// HTTPResponseBoxは引数なしで作成
if !arguments.is_empty() {
return Err(RuntimeError::InvalidOperation {
message: format!("HTTPResponseBox constructor expects 0 arguments, got {}", arguments.len()),
});
}
let http_response_box = Box::new(HTTPResponseBox::new()) as Box<dyn NyashBox>;
return Ok(http_response_box);
}
_ => {}
}