HipcallSMS.HTTPClient behaviour (HipcallSMS v0.3.0)
View SourceBehavior for HTTP client operations.
This behavior defines the contract for making HTTP requests, allowing for easy mocking in tests while using Finch in production.
Summary
Callbacks
Makes an HTTP request.
Callbacks
@callback request( method :: atom(), url :: String.t(), headers :: [{String.t(), String.t()}], body :: binary(), opts :: Keyword.t() ) :: {:ok, %{status: integer(), body: binary(), headers: list()}} | {:error, any()}
Makes an HTTP request.
Parameters
method
- HTTP method (:get, :post, :put, :delete, etc.)url
- Request URLheaders
- List of header tuplesbody
- Request body (optional)opts
- Additional options (optional)
Returns
{:ok, %{status: integer(), body: binary(), headers: list()}}
- Success response{:error, reason}
- Error response