Skip to content

Req#22

Merged
jaimeiniesta merged 4 commits into
masterfrom
req
Jun 2, 2026
Merged

Req#22
jaimeiniesta merged 4 commits into
masterfrom
req

Conversation

@jaimeiniesta

Copy link
Copy Markdown
Owner

No description provided.

Builds a safety net of opt-in integration tests against real hosts
(httpbin.org, badssl.com, hex.pm, github.com, rocketvalidator.com)
covering behaviors that mocks can't catch: TLS handshakes, gzip
streams, redirect chains, basic auth, DNS failures, and full page /
sitemap scraping pipelines.

- test/support/integration_urls.exs: shared URL helpers and a
  with_transient_retry/2 helper that retries 502/503/504 and timeouts
  while letting permanent errors (401/403/404/500) propagate.
- test/integration/{resolver,tls,compression,page_scraper,sitemap}_integration_test.exs:
  one file per behavioral area, all tagged :integration and excluded
  from the default mix test run.
- mix test.all alias for running unit + integration in one command,
  wired through preferred_cli_env so it runs in :test.
- AGENTS.md: documents the new alias.
Introduce Funkspector.HTTP.Adapter behaviour with two adapters:
Funkspector.HTTP.Adapters.Req (new default, Finch/Mint-backed,
hackney-free) and Funkspector.HTTP.Adapters.HTTPoison (opt-in,
preserves the pre-2.0 transport).

Normalize HTTP results across adapters via new %Funkspector.Response{}
and %Funkspector.Error{} structs. Adapter selection is configurable
app-wide (`config :funkspector, :http_adapter, …`) and per-call via the
`:adapter` option.

Make :httpoison and :hackney optional deps; add :req as a required dep.
Add Mix aliases `mix test.httpoison` and `mix test.adapters` so the
full unit + integration suite can be exercised against both adapters.

Breaking: %HTTPoison.Error{} → %Funkspector.Error{} and
%HTTPoison.Response{} → %Funkspector.Response{} in error/response
returns. The :reason atom (`:nxdomain`, `:timeout`, …) is unchanged.
@jaimeiniesta jaimeiniesta requested a review from Copilot May 26, 2026 10:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@jaimeiniesta

Copy link
Copy Markdown
Owner Author

@copilot review

Copilot AI commented May 26, 2026

Copy link
Copy Markdown

@copilot review

I reviewed the PR as requested and did not find any additional changes to apply on top of the current branch state (head commit: d806f9f).

The adapter module references %HTTPoison.Response{} and %HTTPoison.Error{}
structs at compile time, so it could not be compiled in a consumer
project that drops httpoison from its deps — even though mix.exs already
declares httpoison as optional: true.

Wrap the defmodule block in Code.ensure_loaded?(HTTPoison) so the module
is only defined when HTTPoison is actually available. Funkspector's own
test matrix still pulls HTTPoison transitively (optional deps are
included in the package's own build), so test.adapters keeps exercising
both adapters.
@jaimeiniesta jaimeiniesta merged commit 970279e into master Jun 2, 2026
12 of 14 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