mirror of
https://github.com/lune-org/lune.git
synced 2025-04-08 04:20:54 +01:00
Remove debug prints
This commit is contained in:
parent
8ba4055e13
commit
e6a98116a9
4 changed files with 2 additions and 12 deletions
|
@ -60,7 +60,6 @@ impl FromLua<'_> for RequestConfig {
|
|||
fn from_lua(value: LuaValue, lua: &Lua) -> LuaResult<Self> {
|
||||
// If we just got a string we assume its a GET request to a given url
|
||||
if let LuaValue::String(s) = value {
|
||||
println!("{:?}", s);
|
||||
return Ok(Self {
|
||||
url: s.to_string_lossy().to_string(),
|
||||
method: Method::GET,
|
||||
|
|
|
@ -69,8 +69,6 @@ async fn net_request<'lua>(lua: &'lua Lua, config: RequestConfig) -> LuaResult<L
|
|||
where
|
||||
'lua: 'static, // FIXME: Get rid of static lifetime bound here
|
||||
{
|
||||
println!("net_request config {:?}", config);
|
||||
|
||||
// Create and send the request
|
||||
let client = NetClient::from_registry(lua);
|
||||
let mut request = client.request(config.method, &config.url);
|
||||
|
@ -140,27 +138,20 @@ async fn net_serve<'lua>(
|
|||
where
|
||||
'lua: 'static, // FIXME: Get rid of static lifetime bound here
|
||||
{
|
||||
println!("port {:?}", port);
|
||||
|
||||
let sched = lua
|
||||
.app_data_ref::<&Scheduler>()
|
||||
.expect("Lua struct is missing scheduler");
|
||||
|
||||
println!("config {:?}", config);
|
||||
|
||||
let address_pattern = Regex::new(r"(?:.*:\/\/)?([\d\.]+)(?::\d+)?").unwrap();
|
||||
|
||||
let address = match &config.address {
|
||||
Some(addr) => {
|
||||
let caps = address_pattern.captures(addr.to_str()?).unwrap();
|
||||
println!("captures {:?}", &caps);
|
||||
caps[1].parse::<Ipv4Addr>()?
|
||||
}
|
||||
None => Ipv4Addr::new(127, 0, 0, 1),
|
||||
};
|
||||
|
||||
println!("address {:?}", address);
|
||||
|
||||
let builder = bind_to_addr(address, port)?;
|
||||
|
||||
create_server(lua, &sched, config, builder)
|
||||
|
|
|
@ -28,8 +28,6 @@ use super::{
|
|||
pub(super) fn bind_to_addr(address: Ipv4Addr, port: u16) -> LuaResult<Builder<AddrIncoming>> {
|
||||
let addr = SocketAddr::from((address, port));
|
||||
|
||||
println!("attempting to bind to {:?}", addr);
|
||||
|
||||
match Server::try_bind(&addr) {
|
||||
Ok(b) => Ok(b),
|
||||
Err(e) => Err(LuaError::external(format!(
|
||||
|
|
|
@ -21,6 +21,8 @@ local thread = task.delay(1, function()
|
|||
end)
|
||||
|
||||
local handle = net.serve(PORT, function(request)
|
||||
-- print("Request:", request)
|
||||
-- print("Responding with", RESPONSE)
|
||||
assert(request.path == "/some/path")
|
||||
assert(request.query.key == "param2")
|
||||
assert(request.query.key2 == "param3")
|
||||
|
|
Loading…
Add table
Reference in a new issue