Skip to content

Fix CTGov API Connection Issue#1239

Merged
akabishau merged 9 commits intomasterfrom
dev
Oct 20, 2025
Merged

Fix CTGov API Connection Issue#1239
akabishau merged 9 commits intomasterfrom
dev

Conversation

@akabishau
Copy link
Collaborator

This pull request updates the HTTP client stack to improve compatibility, reliability, and HTTP/2 support, while also ensuring the codebase and tests reflect these changes. The most important changes include pinning gem versions for compatibility, switching the Faraday HTTP adapter to Typhoeus for better HTTP/2 support, and updating test expectations and stubs accordingly.

Dependency and HTTP client updates:

  • Pinned the ffi gem to < 1.17.0 to maintain compatibility with Ruby 2.7.7 and RubyGems 3.1.6.
  • Updated faraday to version ~> 2.7 and added the faraday-typhoeus gem to enable the Typhoeus adapter with HTTP/2 support.
  • Changed the Faraday adapter in app/services/http_client.rb to use :typhoeus with HTTP/2, replacing the default adapter.

Test and spec updates:

  • Updated all test stubs and expectations to use the new Faraday user agent string (Faraday v2.8.1) to match the updated gem version.
  • Adjusted test expectations in spec/services/http_client_spec.rb to expect a Faraday::TimeoutError instead of Faraday::ConnectionFailed after retries, reflecting changes in error handling with the new adapter.

Documentation updates:

  • Improved the README.md for clarity, corrected links, and updated descriptions of the application and download page.

SaraBCalvert and others added 9 commits August 13, 2025 18:48
Updated Faraday to version 2.8 and added the faraday-typhoeus gem to enable HTTP/2 support and better mimic curl behavior, bypassing WAF/bot detection. Modified HttpClient to use the Typhoeus adapter. Updated Gemfile and Gemfile.lock dependencies accordingly.
A new step was added to update RubyGems before installing the PostgreSQL client in the build-and-test-not-master GitHub Actions workflow. This ensures the latest RubyGems system is used during CI runs.
Pinned the ffi gem to versions below 1.17.0 for compatibility with Ruby 2.7.7 and RubyGems 3.1.6. Updated the GitHub Actions workflow to enable bundler cache and removed the manual RubyGems update step.
Changed the 'User-Agent' header from Faraday v2.1.0 to v2.8.1 in multiple spec files to reflect the updated Faraday version. Also updated expected error in http_client_spec.rb from ConnectionFailed to TimeoutError for improved accuracy in test assertions.
…e-with-ctogov-api

Add Faraday Typhoeus adapter for HTTP/2 support
@akabishau akabishau requested review from Copilot and micronix October 20, 2025 22:41
Copy link

Copilot AI left a comment

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 addresses CTGov API connection issues by switching from Faraday's default adapter to Typhoeus with HTTP/2 support, along with necessary dependency updates and test adjustments.

Key Changes:

  • Updated Faraday to v2.7+ and added faraday-typhoeus gem for HTTP/2 support via libcurl
  • Switched HTTP adapter from default to Typhoeus with HTTP/2 in the HttpClient service
  • Updated all test stubs to reflect new Faraday v2.8.1 user agent string

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Gemfile Pinned ffi gem for Ruby 2.7.7 compatibility, updated faraday to ~> 2.7, and added faraday-typhoeus dependency
app/services/http_client.rb Replaced default Faraday adapter with Typhoeus configured for HTTP/2
spec/services/http_client_spec.rb Updated expected error type from ConnectionFailed to TimeoutError for retry behavior
spec/models/utils/util_updater_spec.rb Updated stub headers to match Faraday v2.8.1 user agent
spec/models/clinical_trials_api_v2_spec.rb Updated all WebMock stubs with new Faraday v2.8.1 user agent string
spec/mailers/notifier_spec.rb Updated stub headers to match Faraday v2.8.1 user agent
README.md Improved grammar, fixed download page URL from /snapshots to /downloads

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@akabishau akabishau merged commit 16ec282 into master Oct 20, 2025
2 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants