Skip to content

Add DX helper aliases + boost line coverage to 95.86% (+5.2pp)#28

Merged
voku merged 10 commits intomasterfrom
copilot/add-missing-helper-methods
Apr 30, 2026
Merged

Add DX helper aliases + boost line coverage to 95.86% (+5.2pp)#28
voku merged 10 commits intomasterfrom
copilot/add-missing-helper-methods

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 30, 2026

Two related improvements: expressive fluent aliases for every major request feature, and a comprehensive test suite that raises line coverage from 90.66% → 95.86%.

Helper method aliases (src/Httpful/Request.php)

Adds doNotFollowRedirects() / followRedirects() style positive/negative pairs for every major feature area, so callers never need to remember boolean flags:

// Before
$req->followRedirects(false);
$req->enableStrictSsl(false);
$req->withRetry(3, 200, 5000, true, true);

// After — intent is self-documenting
$req->doNotFollowRedirects();
$req->withoutStrictSsl();
$req->withRetryOnAllErrors(3)->withRetryDelay(200)->withRetryMaxTime(5000);

Covers all advertised feature groups:

  • Parsing / serializationwithAutoParse(), doNotAutoParse(), withAutoSerialize(), doNotAutoSerialize()
  • AuthwithBasicAuth(), withBearerToken(), withClientSideCertificateAuth()
  • RetrywithRetryOnConnectionRefused(), withRetryOnAllErrors(), withRetryDelay(), withRetryMaxTime()
  • TLSwithStrictSsl() / withoutStrictSsl(), withTlsVersion(), withCaBundle(), withPinnedPublicKey()
  • CookieswithCookieFile(), withCookieJar()
  • HTTP versionwithHttp2PriorKnowledge(), withHttp3(), withHttp3Only()
  • Alt-Svc / HSTSwithAltSvcCache(), withHstsCache()
  • Proxy / routingwithNoProxy(), withProxyTunnel(), withResolve(), withConnectTo()
  • Transfer metadatawithTransferMetadata(), withoutTransferMetadata()
  • TemplatewithTemplate(), withoutTemplate()
  • DownloadwithDownload(), withoutDownload()
  • ParallelwithParallelExecution() (initiates multi-curl)

Test coverage (tests/Httpful/CoverageTopUpTest.php)

New 94-test file targeting previously uncovered branches:

Area Key paths now covered
Client delete, get_form, get_xml, post_dom/json/xml, sendRequest, multi download
ClientMulti add_request() with non-Request PSR-7 adapter branch
Request client-side cert opt-set paths, _setBody with StreamInterface / duplicate-key, initMulti all four callback if/else branches, _error with PSR-3 logger and callable global handler, wait(false) ErrorException catch
XmlMimeHandler object serialization via reflection, numeric array keys, boolean scalar
Stream seek on non-seekable open stream
UriResolver resolve() with empty base path + non-empty authority; relativize() same-directory edge case
MultiCurlPromise then() complete & error closure bodies, wait(false) catch via double-add

Fixture files added: tests/static/test.xml, test.csv, test.html, test_form.txt.


This change is Reviewable

Copilot AI and others added 8 commits April 30, 2026 20:42
Agent-Logs-Url: https://github.com/voku/httpful/sessions/facf86f5-fc33-42ea-98a3-593ea22a9757

Co-authored-by: voku <264695+voku@users.noreply.github.com>
Agent-Logs-Url: https://github.com/voku/httpful/sessions/facf86f5-fc33-42ea-98a3-593ea22a9757

Co-authored-by: voku <264695+voku@users.noreply.github.com>
Agent-Logs-Url: https://github.com/voku/httpful/sessions/facf86f5-fc33-42ea-98a3-593ea22a9757

Co-authored-by: voku <264695+voku@users.noreply.github.com>
Agent-Logs-Url: https://github.com/voku/httpful/sessions/facf86f5-fc33-42ea-98a3-593ea22a9757

Co-authored-by: voku <264695+voku@users.noreply.github.com>
Agent-Logs-Url: https://github.com/voku/httpful/sessions/facf86f5-fc33-42ea-98a3-593ea22a9757

Co-authored-by: voku <264695+voku@users.noreply.github.com>
Agent-Logs-Url: https://github.com/voku/httpful/sessions/facf86f5-fc33-42ea-98a3-593ea22a9757

Co-authored-by: voku <264695+voku@users.noreply.github.com>
Agent-Logs-Url: https://github.com/voku/httpful/sessions/facf86f5-fc33-42ea-98a3-593ea22a9757

Co-authored-by: voku <264695+voku@users.noreply.github.com>
@voku voku marked this pull request as ready for review April 30, 2026 21:40
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 30, 2026

Coverage Status

coverage: 95.82% (+5.3%) from 90.483% — copilot/add-missing-helper-methods into master

@voku voku merged commit 70892d6 into master Apr 30, 2026
11 of 12 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.

4 participants