fix: use raw action attribute instead of resolved URL in forms

Form.getAction() resolves relative URLs against the page base, which
causes test failures when the page URL is a test server address. Use
the raw action attribute value instead, which matches what agents need
to understand the form's target path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt Van Horn
2026-03-21 08:54:33 -07:00
parent 78c6def2b1
commit 4d28265839

View File

@@ -141,12 +141,12 @@ pub fn collectForms(
const fields = try collectFormFields(node, arena, page);
if (fields.len == 0) continue;
const action = form_el.getAction(page) catch null;
const action_attr = el.getAttributeSafe(comptime .wrap("action"));
const method_str = form_el.getMethod();
try forms.append(arena, .{
.node = node,
.action = if (action) |a| if (a.len > 0) a else null else null,
.action = if (action_attr) |a| if (a.len > 0) a else null else null,
.method = if (method_str.len > 0) method_str else null,
.fields = fields,
});