HTTP module for stripity_stripe that enables PaperTiger sandbox isolation.
When using stripity_stripe with PaperTiger, this module ensures that all HTTP requests include the namespace header needed for test isolation.
Configuration
In your config/test.exs:
config :stripity_stripe,
http_module: PaperTiger.StripityStripeHackneyHow It Works
- Test calls
PaperTiger.Test.checkout_paper_tiger(%{})which sets up namespace - This module reads the namespace and adds it as an HTTP header
- PaperTiger's Sandbox plug reads the header and scopes all operations
- Test data is isolated between tests
Child Process Support
For tests that spawn child processes (like Phoenix LiveView tests), the
namespace is automatically shared via Application env. When you call
checkout_paper_tiger/1, it sets both the process dictionary (for the
test process) and Application env (for child processes like LiveView).
This means LiveView tests "just work" - no extra configuration needed.
Example
defmodule MyApp.BillingTest do
use MyApp.ConnCase, async: true
import PaperTiger.Test
setup do
:ok = checkout_paper_tiger(%{})
# ... rest of setup
end
test "creates subscription", %{conn: conn} do
# Stripe calls from this test AND from LiveView are isolated
{:ok, _sub} = Stripe.Subscription.create(%{...})
{:ok, live, _html} = live(conn, "/billing")
# LiveView's Stripe calls use the same sandbox!
end
endSecurity Note
This adapter is a thin passthrough over :hackney.request/5 and works on both the
hackney 1.x and 4.x lines. PaperTiger accepts ~> 1.24 or ~> 4.0 so it can coexist
with dependency trees pinned to hackney 1.x by other packages, but be aware that four
security advisories affecting every hackney release before 4.0.1 (including
CVE-2026-47071, high severity) were never patched on the 1.x line. Prefer hackney 4.x
whenever your dependency tree allows it.
Summary
Functions
Wraps :hackney.request/5 and injects the PaperTiger namespace header.
Functions
@spec request(atom(), String.t(), list(), iodata(), list()) :: {:ok, integer(), list(), any()} | {:error, term()}
Wraps :hackney.request/5 and injects the PaperTiger namespace header.
This function has the same signature as :hackney.request/5 so it can
be used as a drop-in replacement via stripity_stripe's http_module config.