engine: boosted forms post text/sx, not urlencoded (SX-native write wire)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 34s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 34s
build-request-body's POST-form branch now serialises the form fields to a text/sx body via the serialize primitive (content-type text/sx), instead of FormData -> URLSearchParams -> urlencoded. A hydrated page posts SX; the host reads it via host/sx-body / host/field (the server already accepts both — urlencoded stays the no-engine / login-bootstrap fallback). Recompiled the web stack -> .sxbc. Verified client-agnostically (no DOM, the user's preference): a new sxtp suite test proves the wire contract serialize(engine) <-> host/sx-body(server) round-trips a field dict losslessly, INCLUDING sx_content full of quotes/parens that would break a naive encoder, plus host/field's content-type discrimination + urlencoded fallback (sxtp 43/43). The DOM field-read (dom-query-all + .value) is the one irreducibly- browser bit — left to a targeted Playwright smoke. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -269,16 +269,28 @@
|
||||
(let
|
||||
((fd (host-new "FormData" el)))
|
||||
(dict "url" url "body" fd "content-type" nil))
|
||||
;; SX-native wire: serialise the form fields to a text/sx body
|
||||
;; (the host reads it via host/sx-body / host/field). A hydrated
|
||||
;; page posts SX, not urlencoded; the server still accepts
|
||||
;; urlencoded for the no-engine fallback. See plans/
|
||||
;; relations-as-posts.md ("SX all the way out").
|
||||
(let
|
||||
((fd (host-new "FormData" el))
|
||||
(params (host-new "URLSearchParams" fd)))
|
||||
((payload
|
||||
(reduce
|
||||
(fn (acc f)
|
||||
(let ((nm (dom-get-attr f "name")))
|
||||
(if (and nm (not (= nm "")))
|
||||
(assoc acc nm (or (host-get f "value") ""))
|
||||
acc)))
|
||||
(dict)
|
||||
(dom-query-all el "input, textarea, select"))))
|
||||
(dict
|
||||
"url"
|
||||
url
|
||||
"body"
|
||||
(host-call params "toString")
|
||||
(serialize payload)
|
||||
"content-type"
|
||||
"application/x-www-form-urlencoded"))))
|
||||
"text/sx; charset=utf-8"))))
|
||||
(dict "url" url "body" nil "content-type" nil))))))
|
||||
(define abort-previous-target (fn (el) nil))
|
||||
(define abort-previous (fn (el) nil))
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user