Skip to content

fix: remove deprecated creation http client and usage of it#183

Open
nnicora wants to merge 21 commits intomainfrom
fix/refactor-http-client
Open

fix: remove deprecated creation http client and usage of it#183
nnicora wants to merge 21 commits intomainfrom
fix/refactor-http-client

Conversation

@nnicora
Copy link
Copy Markdown
Contributor

@nnicora nnicora commented Nov 26, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced HTTP client configuration with support for OAuth2, API token, and basic authentication methods
    • Added transport-level attributes configuration
  • Improvements

    • Default HTTP request timeout increased from 10s to 30s
    • Removed deprecated authentication configuration options for cleaner setup

@push-tags-from-workflow push-tags-from-workflow Bot added bug Something isn't working tests refactor labels Nov 26, 2025
@sonarqubecloud
Copy link
Copy Markdown

@sonarqubecloud
Copy link
Copy Markdown

@nnicora nnicora changed the title fix: refactor the http client and usage of it fix: remove deprecated creation http client and usage of it Feb 19, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 17, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 46520918-7b9b-47f7-bcfb-7b105b3e1693

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR modernizes the HTTP client configuration by removing deprecated MTLS fields from the HTTPClient struct and introducing new authentication methods (APIToken, BasicAuth, OAuth2Auth, MTLS) with transport-level attributes. The deprecated NewClient constructor is removed, keeping NewHTTPClient as the primary factory. Default timeout increases from 10s to 30s.

Changes

Cohort / File(s) Summary
Configuration Structure
pkg/commoncfg/config.go
Removed deprecated MTLS fields (RootCAs, InsecureSkipVerify, MinVersion, Cert, CertKey) from HTTPClient struct. Added new authentication/transport fields (APIToken, BasicAuth, OAuth2Auth, MTLS, TransportAttributes). Updated Timeout default from 10s to 30s.
HTTP Client Implementation
pkg/commonhttp/client.go, pkg/commonhttp/client_test.go
Removed deprecated NewClient() function (59 lines). Updated test calls to reference NewHTTPClient as the primary factory function.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 The HTTPClient hops to modern ways,
Deprecated fields fade as OAuth2 stays,
Timeout stretches from ten to thirty seconds wide,
BasicAuth and APIToken join the ride,
A cleaner config, more secure and spry! 🚀

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided by the author, but the template requires detailed information about what the PR does and why it's needed. Add a detailed description following the template, including sections for 'What this PR does / why we need it', any special notes for reviewers, and release notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: removing deprecated HTTP client creation function and its usage throughout the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
pkg/commonhttp/client_test.go (1)

45-45: Consider consolidating duplicate constructor tests.

Lines 45 and 107 correctly switched to commonhttp.NewHTTPClient, but this also makes TestNewClient and TestNewHTTPClient heavily overlapping. Keeping a single table-driven suite will reduce maintenance noise.

Also applies to: 107-107

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/commonhttp/client_test.go` at line 45, Tests TestNewClient and
TestNewHTTPClient are now duplicative because both call
commonhttp.NewHTTPClient; consolidate them into a single table-driven test
(e.g., TestNewHTTPClient) that enumerates all existing cases from both tests,
reference commonhttp.NewHTTPClient in each case, remove the redundant
TestNewClient, and ensure each table entry includes name, input args and
expected error/behavior so assertion logic remains shared and clear.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pkg/commoncfg/config.go`:
- Line 371: Add a regression test that loads the config via the existing loader
(which calls defaults.Set()) and verifies the HTTPClient.Timeout default is
applied when omitted: create a test case that unmarshals a config YAML/JSON that
includes an HTTPClient entry without the Timeout field, call the config loader
used in loader.go (ensure defaults.Set() runs), then assert the resulting
HTTPClient.Timeout equals 30*time.Second (matching the Timeout tag on the
Timeout field in pkg/commoncfg/config.go). Target the same test package and use
the same loader helper used by other tests so the defaults behavior is
exercised.

---

Nitpick comments:
In `@pkg/commonhttp/client_test.go`:
- Line 45: Tests TestNewClient and TestNewHTTPClient are now duplicative because
both call commonhttp.NewHTTPClient; consolidate them into a single table-driven
test (e.g., TestNewHTTPClient) that enumerates all existing cases from both
tests, reference commonhttp.NewHTTPClient in each case, remove the redundant
TestNewClient, and ensure each table entry includes name, input args and
expected error/behavior so assertion logic remains shared and clear.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 92b8b351-be53-46d8-b11d-b5894b53c300

📥 Commits

Reviewing files that changed from the base of the PR and between 231c1f8 and 0e92c41.

📒 Files selected for processing (3)
  • pkg/commoncfg/config.go
  • pkg/commonhttp/client.go
  • pkg/commonhttp/client_test.go
💤 Files with no reviewable changes (1)
  • pkg/commonhttp/client.go

Comment thread pkg/commoncfg/config.go Outdated
cb80
cb80 previously approved these changes Mar 23, 2026
@nnicora nnicora requested a review from cb80 April 15, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci-cd refactor tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants