Repository navigation
[Backport release-1.12] Fix(cuex): send vela/http request headers as the template declares them - #7621
Closed
briankane wants to merge 2 commits into
Closed
[Backport release-1.12] Fix(cuex): send vela/http request headers as the template declares them#7621briankane wants to merge 2 commits into
briankane wants to merge 2 commits into
Conversation
vela/http's template declares request headers and trailers as one string per name, but guardedhttp decoded them into the upstream RequestVars, which takes http.Header, a list per name. CUE refuses a list and the decoder refuses a string, so a component, trait, policy or source template could set no request header at all: the call failed with "cannot unmarshal string into Go struct field DoParams.$params.request.header.X-Token of type []string". guardedhttp now reads the request with its own params type, one string per name, and builds the http.Header. This matches the vela/http workflow provider, which has always taken headers this way, and does not wait on a kubevela/pkg bump, so it backports to every release line that has guardedhttp. Signed-off-by: Brian Kane <briankane1@gmail.com> (cherry picked from commit 829a2a3)
Bump kubevela/pkg to ff99f28 (kubevela/pkg#157), which reads request headers and trailers as one string per name and exports NewRequest. guardedhttp drops its own request types and builds the request with NewRequest, keeping only its own client and response read. Headers are now added with Header.Add, so names that differ only in case (X-Tag, x-tag) each reach the request. Signed-off-by: Brian Kane <briankane1@gmail.com>
briankane
requested review from
FogDong,
Somefive,
anoop2811,
chivalryq,
jerrinfrancis,
jguionnet,
leejanee,
roguepikachu,
wangyikewxgm and
wonderflow
as code owners
November 19, 2026 10:33
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-1.12 #7621 +/- ##
================================================
+ Coverage 81.20% 81.91% +0.70%
================================================
Files 496 524 +28
Lines 52884 57537 +4653
================================================
+ Hits 42944 47130 +4186
- Misses 9937 10403 +466
- Partials 3 4 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
Author
|
Folded into #7591 (squashed with the kubevela/pkg bump), closing in favour of it. |
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.
Description of your changes
Backport to
release-1.12of #7596:vela/httpin component, trait, policy and source templates can send request headers again. The template declares one string per name, but the request decoded headers ashttp.Header(a list per name), so any call setting a header failed at render withcannot unmarshal string into Go struct field DoParams.$params.request.header... of type []string.The same two commits as #7596:
guardedhttpreads the request with params of its own, one string per name.guardedhttpbuilds its request withkvhttp.NewRequest. Headers are added withHeader.Add, so names differing only in case each reach the request. The bump also brings Fix(cel): bound an expression's evaluation by cost and by its caller's context pkg#156 (CEL evaluation bounded by cost and by its caller's context), as on master.Issue: #7595
I have:
How has this code been tested
The guardedhttp specs render templates through the real compiler against a local HTTP server: two request headers both arrive, and
X-Tag/x-tagboth arrive. Each fails onrelease-1.12without its fix.go build ./...andgo test ./pkg/cue/...pass with no workspace file.