wojtekmach/req

[Q] how to test a failed requests??

dkuku opened this issue · 1 comments

how to test a failed requests??
I'm using Req.Test.stub and for successful requests it works fine:

      Req.Test.stub(MyApp.Client, fn conn ->
        Req.Test.json(conn, %{})
      end)

But how to simulate errors ?

On req main you can do:

Req.Test.transport_error(conn, :econnrefused)

to simulate network errors.

it’s totally fine to ask questions in the issue tracker but as Req hopefully becomes more popular consider instead asking them on elixir forum and similar so a broader community can help and more importantly the answers are more visible to folks.