wftest YAML runner: add PUT, PATCH, DELETE, HEAD trigger types#371
wftest YAML runner: add PUT, PATCH, DELETE, HEAD trigger types#371
Conversation
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> Agent-Logs-Url: https://github.com/GoCodeAlone/workflow/sessions/2ff5f0e6-134e-4abf-aedc-d28b626fb97a
There was a problem hiding this comment.
Pull request overview
Adds support in the wftest YAML test runner for additional HTTP trigger types (PUT, PATCH, DELETE, HEAD) so YAML tests can exercise the same HTTP methods already exposed by the Harness.
Changes:
- Extend
fireTrigger()to dispatchhttp.put/put,http.patch/patch,http.delete/delete, andhttp.head/headto the correspondingHarnessmethods. - Add YAML-runner tests covering each newly supported method, including both the
http.<method>form and the short alias.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| wftest/yaml_runner.go | Adds new HTTP trigger-type cases in fireTrigger() for PUT/PATCH/DELETE/HEAD. |
| wftest/yaml_runner_test.go | Adds tests ensuring the YAML runner can execute PUT/PATCH/DELETE/HEAD triggers (including alias forms). |
| body := "" | ||
| if tc.Trigger.Data != nil { | ||
| b, _ := json.Marshal(tc.Trigger.Data) | ||
| body = string(b) | ||
| } |
There was a problem hiding this comment.
In the PUT trigger case, json.Marshal errors are ignored (b, _ := json.Marshal(...)). If trigger.data contains a value that can’t be marshaled, this will silently send an empty/partial body and make failures hard to diagnose. Please handle the marshal error (fail the test) rather than discarding it (and consider aligning POST/PUT/PATCH to use the same helper).
| body := "" | ||
| if tc.Trigger.Data != nil { | ||
| b, _ := json.Marshal(tc.Trigger.Data) | ||
| body = string(b) | ||
| } |
There was a problem hiding this comment.
In the PATCH trigger case, json.Marshal errors are ignored (b, _ := json.Marshal(...)). It’s better to fail the test on marshal errors so malformed trigger.data doesn’t silently change the request body.
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
|
@copilot apply changes based on the comments in this thread |
…ATCH/DELETE/HEAD triggers Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> Agent-Logs-Url: https://github.com/GoCodeAlone/workflow/sessions/00318fe7-5a64-450d-9dff-ee0a9dde72b6
Applied in 86a5022:
|
|
@copilot Address any failing tests, linters, etc |
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> Agent-Logs-Url: https://github.com/GoCodeAlone/workflow/sessions/22b0d028-ed30-4d60-9b90-6ce6f8ed9fe9
Fixed in 9e5a229. |
fireTrigger()in the YAML test runner only dispatchedpipeline,get, andpost— leavingPUT,PATCH,DELETE, andHEADunsupported despite theHarnessalready exposing those methods.Changes
wftest/yaml_runner.go: Addedhttp.put/put,http.patch/patch,http.delete/delete, andhttp.head/headcases tofireTrigger(), following the same pattern as the existing GET/POST cases (JSON-marshaltrigger.dataas body for PUT/PATCH; header forwarding for all)wftest/yaml_runner_test.go: Added one test per new method, each covering bothhttp.<method>and the short<method>aliasExample
Original prompt
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.