feat(executor): expose ctx.request.method to scripts (F4)

The request map exposed path/headers/body/params/query/rest but not the
HTTP method, forcing one script per verb (the E2E app needed 7 scripts
where ~3 would do). Add a `method` field to ExecRequest (populated from
the HTTP method on the sync-execute bypass and the HTTP outbox payload;
empty for non-HTTP triggers) and surface it as `ctx.request.method`,
uppercased. A single script can now branch GET/POST on one route.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-06-12 20:43:10 +02:00
parent 04a24ea0b7
commit ae2134e62d
21 changed files with 49 additions and 0 deletions

View File

@@ -357,6 +357,8 @@ impl Dispatcher {
script_name: script.name.clone(),
invocation_type: InvocationType::Function,
path: "/trigger/queue".into(),
// Non-HTTP trigger invocation — no request method.
method: String::new(),
headers: std::collections::BTreeMap::new(),
body: serde_json::Value::Null,
params: std::collections::BTreeMap::new(),
@@ -658,6 +660,8 @@ impl Dispatcher {
script_name: resolved.script_name.clone(),
invocation_type: InvocationType::Function,
path: format!("/trigger/{}", trigger_event.source()),
// Non-HTTP trigger invocation — no request method.
method: String::new(),
headers: std::collections::BTreeMap::new(),
body: serde_json::Value::Null,
params: std::collections::BTreeMap::new(),
@@ -719,6 +723,7 @@ impl Dispatcher {
script_name: payload.script_name.clone(),
invocation_type: InvocationType::Http,
path: payload.path.clone(),
method: payload.method.clone(),
headers: payload.headers,
body: payload.body,
params: payload.params,
@@ -814,6 +819,7 @@ impl Dispatcher {
script_name: script.name.clone(),
invocation_type: InvocationType::Function,
path: "/invoke_async".into(),
method: String::new(),
headers: std::collections::BTreeMap::new(),
body: args,
params: std::collections::BTreeMap::new(),