crawlie v0.3.0 Crawlie.HttpClient.MockClient
Summary
Functions
Implements the Crawlie.HttpClient
behaviour
A helper :mock_client_fun
returning a :foo
error for any passed url
A helper :mock_client_fun
returning "<html />"
for any passed url
A helper :mock_client_fun
returning a success and the passed url
Functions
Implements the Crawlie.HttpClient
behaviour.
Example
iex> fun = fn(url) -> {:ok, url <> " body"} end
iex> opts = [mock_client_fun: fun]
iex> Crawlie.HttpClient.MockClient.get("http://a.bc/", opts)
{:ok, "http://a.bc/ body"}
A helper :mock_client_fun
returning a :foo
error for any passed url.
Example
iex> alias Crawlie.HttpClient.MockClient
iex> fun = MockClient.return_error(:foo)
iex> fun.("http://foo.bar/")
{:error, :foo}