-
Notifications
You must be signed in to change notification settings - Fork 11
feat: adds http patch support to cel expressions #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -728,3 +728,251 @@ func Test_impl_post_request_with_400_bad_request(t *testing.T) { | |||||||||
| assert.Equal(t, body["code"], "INVALID_DATA") | ||||||||||
| assert.Equal(t, body["statusCode"], http.StatusBadRequest) | ||||||||||
| } | ||||||||||
|
|
||||||||||
| func Test_impl_put_request(t *testing.T) { | ||||||||||
| base, err := compiler.NewBaseEnv() | ||||||||||
| assert.NoError(t, err) | ||||||||||
| assert.NotNil(t, base) | ||||||||||
|
|
||||||||||
| ctx := Context{&contextImpl{ | ||||||||||
| client: testClient{ | ||||||||||
| doFunc: func(req *http.Request) (*http.Response, error) { | ||||||||||
| assert.Equal(t, req.URL.String(), "http://localhost:8080") | ||||||||||
| assert.Equal(t, req.Method, "PUT") | ||||||||||
|
|
||||||||||
| var data any | ||||||||||
| err := json.NewDecoder(req.Body).Decode(&data) | ||||||||||
| assert.NoError(t, err) | ||||||||||
| assert.Equal(t, data.(map[string]any)["key"], "value") | ||||||||||
| assert.Equal(t, data.(map[string]any)["foo"], float64(2)) | ||||||||||
|
|
||||||||||
| return &http.Response{StatusCode: http.StatusOK, Body: io.NopCloser(strings.NewReader(`{"body": "updated"}`))}, nil | ||||||||||
| }, | ||||||||||
| }, | ||||||||||
| }} | ||||||||||
|
|
||||||||||
| env, err := base.Extend( | ||||||||||
| Lib(&ctx, version.MajorMinor(1, 18)), | ||||||||||
| ) | ||||||||||
| assert.NoError(t, err) | ||||||||||
| assert.NotNil(t, env) | ||||||||||
| ast, issues := env.Compile(`http.Put("http://localhost:8080", { "key": dyn("value"), "foo": dyn(2) })`) | ||||||||||
| fmt.Println(issues.String()) | ||||||||||
|
||||||||||
| fmt.Println(issues.String()) | |
| if issues != nil { | |
| t.Log(issues.String()) | |
| } |
Copilot
AI
Apr 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fmt.Println(issues.String()) writes to stdout during go test runs and makes CI output noisy. Consider removing it, or switching to t.Log/Logf only when issues != nil and issues.Err() != nil (or equivalent) to log failures only.
Copilot
AI
Apr 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fmt.Println(issues.String()) writes to stdout during go test runs and makes CI output noisy. Consider removing it, or switching to t.Log/Logf only when issues != nil and issues.Err() != nil (or equivalent) to log failures only.
Copilot
AI
Apr 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fmt.Println(issues.String()) writes to stdout during go test runs and makes CI output noisy. Consider removing it, or switching to t.Log/Logf only when issues != nil and issues.Err() != nil (or equivalent) to log failures only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buildRequestDatareturns an error message that hard-codes "HTTP POST data", but this code path is now used by PUT (and PATCH below). Consider making the error message method-agnostic (or passing the HTTP method into the helper) so failures during PUT/PATCH encoding don't misleadingly mention POST.