From 380f1e9ce7611885214fc66922c5c035d5ed0cd7 Mon Sep 17 00:00:00 2001 From: Wojtek Mach Date: Wed, 11 Sep 2024 13:42:23 +0200 Subject: [PATCH] Show example of setting cacertfile, closes #412 --- lib/req.ex | 8 ++++++++ lib/req/steps.ex | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/lib/req.ex b/lib/req.ex index 424fdc2..81a29a2 100644 --- a/lib/req.ex +++ b/lib/req.ex @@ -40,6 +40,14 @@ defmodule Req do iex> Req.post!("https://httpbin.org/post", form: [comments: "hello!"]).body["form"] %{"comments" => "hello!"} + Set connection timeout: + + iex> resp = Req.get!("https://httpbin.org", connect_options: [timeout: 100]) + iex> resp.status + 200 + + See [`run_finch`](`Req.Steps.run_finch/1`) for more connection related options and usage examples. + Stream request body: iex> stream = Stream.duplicate("foo", 3) diff --git a/lib/req/steps.ex b/lib/req/steps.ex index 5bd56e5..6f19660 100644 --- a/lib/req/steps.ex +++ b/lib/req/steps.ex @@ -771,6 +771,10 @@ defmodule Req.Steps do iex> Req.get!(url, connect_options: [transport_opts: [verify: :verify_none]]) + Connecting with custom certificates: + + iex> Req.get!(url, connect_options: [transport_opts: [cacertfile: "certs.pem"]]) + Connecting through a proxy with basic authentication: iex> Req.new(