Add a pre-send request payload hook (client and spec level)
Les mainteneurs répondent en général sous 1 jour
@BlueLabelscotch y travaille déjà.
Depuis le 29/11/2026.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- go
- Domaine
- cli, developer-experience
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Go
- Étoiles
- 29
- Forks
- 24
- Merge moyen
- 1 j 9 h
- PR mergées (30 j)
- 111
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de harness/cli
-
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 Une demi-journée Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 45/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de harness/cli
Issues similaires
-
Project submission: SpecWithCodeOuverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
slavakurilyak/awesome-ai-agents#1137 ·
Les mainteneurs répondent en général sous 1 jour
-
Make the HTTP server's keep-alive and headers timeouts configurablePeut-être pris @mattgodbolt l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
compiler-explorer/compiler-explorer#9902 ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
ready-for-agent
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
jordansmall/spindrift#7895 ·
Les mainteneurs répondent en général sous 1 jour
-
documentation priority: medium skill: intermediate status: ready for dev
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
hyperledger-labs/fabric-smart-client#2830 ·
Les mainteneurs répondent en général sous 1 jour