Add a pre-send request payload hook (client and spec level)
Maintainer thường phản hồi trong vòng 1 ngày
@BlueLabelscotch đang làm issue này rồi.
Từ ngày 29/11/2026.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- go
- Lĩnh vực
- cli, developer-experience
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Go
- Star
- 29
- Fork
- 24
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 111
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của harness/cli
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Project submission: SpecWithCodeĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
slavakurilyak/awesome-ai-agents#1137 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Make the HTTP server's keep-alive and headers timeouts configurableCó thể đã có người làm @mattgodbolt đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
compiler-explorer/compiler-explorer#9902 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
jordansmall/spindrift#7895 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation priority: medium skill: intermediate status: ready for dev
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
hyperledger-labs/fabric-smart-client#2830 ·
Maintainer thường phản hồi trong vòng 1 ngày