publish form: per-method HTTP param resolution (query/path/path_raw/body/header)#54
Merged
Merged
Conversation
…ody/header)
For HTTP-backend methods, publishers can now set the full request mapping:
- verb: GET | POST | PUT | PATCH | DELETE (was just GET/POST)
- path: a path template that may contain {name} placeholders, with helper text
- per param: an 'in' resolution selector — query | path | path_raw | body | header,
each with a one-line explanation in the option title and the column tooltip.
Defaults keep simple forms zero-click: a param with no explicit 'in' resolves to
the verb's natural location (GET/DELETE -> query, POST/PUT/PATCH -> body), shown
as '(default)' in the dropdown. submission() emits 'in' on every HTTP param and the
method's http {verb, path}, matching the app-template submission shape exactly;
CLI-backend params are unchanged and emit no 'in'.
path / path_raw are only meaningful when the param name appears as {name} in the
path template — the UI shows an inline hint and client-side validation blocks
submit until it does. Live preview, the review table, and the /plain mirror all
reflect the new verb/path and per-param mapping.
|
🚀 Preview deployed to Cloudflare Pages
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Extends the Publish an app wizard (
src/pages/publish.astro, the Methods step) so that for each HTTP-backend method, publishers can specify the full request mapping — not just a verb and path, but where every parameter is resolved from when the adapter calls the backend.Changes (HTTP-backend methods only — CLI path untouched)
Per method:
GET | POSTtoGET | POST | PUT | PATCH | DELETE.{name}placeholders, with updated helper text.Per parameter, a new In column with a resolution selector:
query?name=value(url-encoded). Default for GET.path{name}in the path, url-encoded (REST).path_raw{name}in the path unescaped — for URL-in-path APIs (e.g. a fetch/proxy takingGET /<rawurl>).bodyheaderEach option carries a one-line explanation (option
title+ column tooltip).Easy to configure (zero extra clicks for simple forms)
A param with no explicit
inresolves to the verb's natural location at submit time —GET/DELETE→query,POST/PUT/PATCH→body— shown as(default)in the dropdown. Existing simple forms keep working unchanged.Submission shape alignment
submission()now emits"in": "<value>"on every HTTP param and the method'shttp: {verb, path}, matching the app-template submission shape exactly (submissions/<id>/case.json). CLI params are unchanged and emit noin.Validation, preview & mirrors
path/path_raware only meaningful when the param name appears as{name}in the path template. The UI shows an inline hint (Add {name} to the path…) and client-side validation blocks submit until it does.url→path_raw)./plain/publishtext mirror is updated to describe the new mapping.Validation done
npx astro build— 190 pages, no errors.node --check; verbs +path_raw+p-inpresent in the built bundle and CSS.query (default) | path | path_raw | body | header, the{name}hint correctly appears/disappears as the path template changes.Screenshot — new per-method / per-param UI
HTTP method card with the Verb dropdown,
{url}path template, and the per-param In selector set topath_raw:(captured locally —
fetch.getmethod,urlparam mapped topath_raw)