Merge sx-tools: test coverage + bug fixes + Playwright fixes
- 7 new test files (~268 tests): stdlib, adapter-html, adapter-dom, boot-helpers, page-helpers, layout, tw-layout - Fix component-pure? transitive scan, render-target crash on unknown components, &rest param binding (String vs Symbol), swap! extra args - Fix 5 Playwright marshes tests: timing + test logic - 2522/2522 OCaml tests, 173/173 Playwright tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> # Conflicts: # shared/static/wasm/sx/orchestration.sxbc # shared/static/wasm/sx_browser.bc.js # shared/static/wasm/sx_browser.bc.wasm.js # sx/sx/not-found.sx # tests/playwright/isomorphic.spec.js
This commit is contained in:
@@ -2706,18 +2706,19 @@ let http_mode port =
|
||||
let req_method = String.uppercase_ascii !_req_method in
|
||||
let try_key k = try let v = env_get env k in
|
||||
if v <> Nil then Some (k, v) else None with _ -> None in
|
||||
let base = "handler:ex-" ^ slug in
|
||||
(* Try multiple handler name patterns: ex-slug, reactive-slug, slug *)
|
||||
let prefixes = ["handler:ex-" ^ slug; "handler:reactive-" ^ slug; "handler:" ^ slug] in
|
||||
let suffixes = match req_method with
|
||||
| "POST" -> [base; base ^ "-save"; base ^ "-submit"]
|
||||
| "PUT" | "PATCH" -> [base; base ^ "-put"; base ^ "-save"]
|
||||
| "DELETE" -> [base]
|
||||
| _ -> [base; base ^ "-form"; base ^ "-status"] in
|
||||
| "POST" -> List.concat_map (fun base -> [base; base ^ "-save"; base ^ "-submit"]) prefixes
|
||||
| "PUT" | "PATCH" -> List.concat_map (fun base -> [base; base ^ "-put"; base ^ "-save"]) prefixes
|
||||
| "DELETE" -> prefixes
|
||||
| _ -> List.concat_map (fun base -> [base; base ^ "-form"; base ^ "-status"]) prefixes in
|
||||
let found = List.fold_left (fun acc k ->
|
||||
match acc with Some _ -> acc | None -> try_key k) None suffixes in
|
||||
(match found with
|
||||
| None ->
|
||||
http_response ~status:404 ~content_type:"text/sx; charset=utf-8"
|
||||
(Printf.sprintf "(div :class \"p-4 text-rose-600\" \"Handler not found: %s\")" base)
|
||||
(Printf.sprintf "(div :class \"p-4 text-rose-600\" \"Handler not found: %s\")" (List.hd prefixes))
|
||||
| Some (_hk, hdef) ->
|
||||
(match path_param_val with
|
||||
| Some pval ->
|
||||
|
||||
Reference in New Issue
Block a user