Add HTTP::Convert tests and fix Curl.pm dead code#69
Draft
Conversation
HTTP::Convert is the shared error-routing layer between both HTTP backends (HTTP_Tiny and Curl) but had zero direct test coverage. 38 tests covering: success responses (200/201/204), redirects (301), network errors (599 with connection refused, TLS failures, redirects), protocol errors (400/403/404/500 with headers/redirects), and the 399/400 boundary condition. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The elsif branch on line 239 already guarantees ref($value) is true, making the inner `die ... if ref $value` tautological. Also replaced the bare string die with a structured X::Generic exception that reports the actual ref type and header name for debuggability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add 38 direct tests for
Net::ACME2::HTTP::Convertand fix a dead code / bare die issue inCurl.pm.Why
HTTP::Convertis the shared error-routing layer between both HTTP backends (HTTP_Tiny and Curl) but had zero direct test coverage. This module decides whether a response becomes a success object, a network exception, or a protocol exception -- getting this wrong silently breaks both backends.The
_assign_headersfunction inCurl.pmhad a tautological condition (die ... if ref $valueinside anelsif (ref $value)block) and used a bare string die instead of a structured exception.How
http_tiny_to_net_acme2(): success (200/201/204/301/399), network error (599 with various content), and protocol error (400/403/404/500).diewithX::Genericthat reports the ref type and header name.Testing
All 345 tests pass across 21 files (including the 38 new ones).
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Quality Report
Changes: 3 files changed, 345 insertions(+), 1 deletion(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline