Skip to content

expr: add HTTP helpers#4533

Open
blotus wants to merge 3 commits into
masterfrom
expr-helpers-http-request
Open

expr: add HTTP helpers#4533
blotus wants to merge 3 commits into
masterfrom
expr-helpers-http-request

Conversation

@blotus

@blotus blotus commented Jun 30, 2026

Copy link
Copy Markdown
Member

No description provided.

@github-actions

Copy link
Copy Markdown

@blotus: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.

  • /kind feature
  • /kind enhancement
  • /kind refactoring
  • /kind fix
  • /kind chore
  • /kind dependencies
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

@github-actions

Copy link
Copy Markdown

@blotus: There are no area labels on this PR. You can add as many areas as you see fit.

  • /area agent
  • /area local-api
  • /area cscli
  • /area appsec
  • /area security
  • /area configuration
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.62500% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.08%. Comparing base (4e57efb) to head (be1989a).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
pkg/exprhelpers/http.go 65.62% 11 Missing and 11 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4533       +/-   ##
===========================================
+ Coverage   37.57%   64.08%   +26.51%     
===========================================
  Files         460      479       +19     
  Lines       33569    34369      +800     
===========================================
+ Hits        12614    22026     +9412     
+ Misses      19595    10167     -9428     
- Partials     1360     2176      +816     
Flag Coverage Δ
bats 46.37% <0.00%> (?)
unit-linux 37.63% <65.62%> (+0.06%) ⬆️
unit-windows 26.80% <65.62%> (?)

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.

@blotus

blotus commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

/kind enhancement

@github-actions github-actions Bot added kind/enhancement New feature or request and removed needs/kind labels Jul 1, 2026
@blotus blotus requested a review from Copilot July 1, 2026 11:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds outbound HTTP helper functions to the pkg/exprhelpers expression library so expressions can make basic HTTP requests and inspect response status/body/headers.

Changes:

  • Introduces HTTPGet, HTTPHead, HTTPPost, and HTTPRequest helpers backed by a shared http.Client (timeout + default User-Agent injection).
  • Adds unit tests validating the helpers and a basic expr integration test.
  • Registers the new helpers in pkg/exprhelpers/expr_lib.go so they’re available to GetExprOptions(...).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
pkg/exprhelpers/http.go Adds HTTP client + request helpers and HTTPResponse type exposed to expr.
pkg/exprhelpers/http_test.go Adds tests for the new HTTP helpers and an expr integration test.
pkg/exprhelpers/expr_lib.go Registers the new HTTP helpers in the expr function list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/exprhelpers/http.go
Comment thread pkg/exprhelpers/http.go
Comment thread pkg/exprhelpers/http.go Outdated
Comment thread pkg/exprhelpers/http.go Outdated
Comment thread pkg/exprhelpers/expr_lib.go Outdated
@blotus blotus added this to the Next release milestone Jul 6, 2026

@sabban sabban left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@sabban sabban left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement New feature or request needs/area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants