Some checks failed
CI/CD Pipeline / unit-tests (push) Failing after 1m16s
CI/CD Pipeline / integration-tests (push) Failing after 2m32s
CI/CD Pipeline / lint (push) Successful in 5m22s
CI/CD Pipeline / e2e-tests (push) Has been skipped
CI/CD Pipeline / build (push) Has been skipped
33 lines
904 B
Rust
33 lines
904 B
Rust
use functions::deno_runtime::DenoRuntime;
|
|
use std::collections::HashMap;
|
|
use serde_json::json;
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
tracing_subscriber::fmt::init();
|
|
|
|
let runtime = DenoRuntime::new();
|
|
let code = r#"
|
|
Deno.serve((req) => {
|
|
return new Response("Hello from reproduction!");
|
|
});
|
|
"#.to_string();
|
|
|
|
let payload = Some(json!({"test": "data"}));
|
|
let headers = HashMap::new();
|
|
|
|
println!("Starting execution...");
|
|
match runtime.execute(code, payload, headers).await {
|
|
Ok((stdout, stderr, status, res_headers)) => {
|
|
println!("Success!");
|
|
println!("Status: {}", status);
|
|
println!("Stdout: {}", stdout);
|
|
println!("Stderr: {}", stderr);
|
|
println!("Headers: {:?}", res_headers);
|
|
},
|
|
Err(e) => {
|
|
eprintln!("Error: {:?}", e);
|
|
}
|
|
}
|
|
}
|