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

Merged
MA
6d ago
+46-1

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.)