Skip to content

Feat(cuex): allow HEAD in the vela/http provider - #159

Merged
briankane merged 1 commit into
kubevela:mainfrom
marcus-beauregard:feat/http-provider-head
Nov 21, 2026
Merged

briankane merged 1 commit into
kubevela:mainfrom
marcus-beauregard:feat/http-provider-head

Conversation

@marcus-beauregard

@marcus-beauregard marcus-beauregard commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #158.

Adds HEAD to the method enum in cue/cuex/providers/http/http.cue, plus a #Head helper next to the existing #Get/#Post/#Trace ones so a template can ask for a headers-only request without spelling the method out. Do already passes the method straight to http.NewRequestWithContext, so no Go change was needed.

The new TestDoHeadRequest compiles a template through the provider package against an httptest.Server, then asserts the method the server actually saw, the 200 status, and that the returned body is empty.

Verification (go1.27.1):

go test ./cue/cuex/providers/http/ -run TestDo -v
--- PASS: TestDo
--- PASS: TestDoSendsRequestHeaders
--- PASS: TestDoSendsCaseVariantHeaders
--- PASS: TestDoHeadRequest
ok  github.com/kubevela/pkg/cue/cuex/providers/http

gofmt clean. If you'd rather keep the diff to the enum and the test only, I'll drop the #Head helper — it's there for symmetry with the other methods.

(The change and test were drafted with AI assistance; I ran the package tests locally before opening.)

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

Reply to a comment to ask cubic a question or push back. It learns from your replies.
Click Fix with cubic on a comment, or reply @cubic-dev-ai fix this, and cubic writes the fix.

View guided diff | Re-trigger cubic

Comment thread cue/cuex/providers/http/http_test.go Resolved
Signed-off-by: Marcus Beauregard <marcus.beauregard.developer@gmail.com>
@marcus-beauregard

marcus-beauregard commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Good catch — the header was set up but never checked, so the test would have passed even if HEAD dropped the headers.

Added the missing assertion in TestDoHeadRequest: it now looks up r.$returns.header["X-Head"], requires the key to exist, and compares the value list against ["yes"], alongside the existing empty-body and 200 assertions. go vet and go test ./cue/cuex/providers/http/ are clean, force-pushed as 2b032b0.

@codecov

codecov Bot commented Nov 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.55%. Comparing base (ff99f28) to head (2b032b0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #159   +/-   ##
=======================================
  Coverage   92.55%   92.55%           
=======================================
  Files         115      115           
  Lines        6944     6944           
=======================================
  Hits         6427     6427           
  Misses        517      517           
Flag Coverage Δ
unit-test 92.55% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@briankane briankane added area/cuex CueX compiler and providers (cue/cuex) priority/nice-to-have It's a good idea, but not scheduled for any release. type/enhancement New feature or request labels Nov 21, 2026
@briankane
briankane merged commit e062254 into kubevela:main Nov 21, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cuex CueX compiler and providers (cue/cuex) priority/nice-to-have It's a good idea, but not scheduled for any release. type/enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cuex HTTP provider: add HEAD to the allowed methods

2 participants