Add a pre-send request payload hook (client and spec level)
I maintainer di solito rispondono entro 1 giorno
@BlueLabelscotch ci sta già lavorando.
Dal 29/11/2026.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- cli, developer-experience
Direzione di ricerca
Start by reading client.Request, DoRequest, and buildRequest to trace how request bodies are assembled, serialized, and shown by --preview-request; also read docs/mutation.md for the existing update_body_pick behavior. Define the hook and spec key after resolving the open questions about the expression signature and query parameters. Done means the JSON round-trip and error handling are covered, and the transformed payload is used before sending.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
Some APIs reject the body we build, and the spec has no way to fix it up just before the request goes out. Example, GitOps repo credential update: the GET returns connectionState.attemptedAt as a string, but PUT expects {seconds, nanos}, so a get-then-put round trip fails with a 400. The UI avoids this by sending only writable fields plus an updateMask.
Today the options are hand-picking every field in update_body_pick (silently drops new API fields, see docs/mutation.md) or special-casing it in core.
Proposed design
1. Low-level hook in the client. client.Request gets an optional payload function that runs immediately before the body is serialized and sent:
type Request struct {
...
BodyFn func(body any) (any, error)
}
DoRequestapplies it afterbuildRequestassembles the body, so every caller (get-then-put, create, execute) can use it.- The body is round-tripped through JSON (marshal, then unmarshal into a generic Go value) before the function runs, so the function always edits a plain
map[string]anyregardless of how the body was built. --preview-requestshows the transformed body.
2. Spec-level declaration. A spec key on the endpoint (name TBD, e.g. body_transform) takes an expr function that is wired to the hook, so a noun can fix its own payload without Go changes, e.g. convert attemptedAt to {seconds, nanos} or derive updateMask from the keys changed by --set.
Scope
- Core change first (client hook plus spec key); adopting it for
gitops_repocredis a separate module PR. - No tests for the framework passing the function through; cover the JSON round-trip and error handling.
Open questions
- Name of the spec key and the expr function signature.
- Whether the same hook should also be able to rewrite query params (see #527).
- Whether to also raise the
attemptedAtread/write mismatch as a server-side issue.
Related: #527, #509.
- Lingua principale
- Go
- Stelle
- 29
- Fork
- 24
- Merge medio
- 1g 9h
- PR unite (30g)
- 111
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di harness/cli
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
slavakurilyak/awesome-ai-agents#1137 ·
I maintainer di solito rispondono entro 1 giorno
-
Make the HTTP server's keep-alive and headers timeouts configurableForse già presa @mattgodbolt l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
compiler-explorer/compiler-explorer#9902 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
jordansmall/spindrift#7895 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation priority: medium skill: intermediate status: ready for dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
hyperledger-labs/fabric-smart-client#2830 ·
I maintainer di solito rispondono entro 1 giorno