Skip to content

Commit af1a34f

Browse files
committed
run_finch: Fix defaulting to using just HTTP/1
1 parent 7148e42 commit af1a34f

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

lib/req.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ defmodule Req do
361361
362362
* `:timeout` - socket connect timeout in milliseconds, defaults to `30_000`.
363363
364-
* `:protocols` - the HTTP protocols to use, defaults to `[:http1]`.
364+
* `:protocols` - the HTTP protocols to use, defaults to `#{inspect(Req.Application.__default_protocols__())}`.
365365
366366
* `:hostname` - Mint explicit hostname.
367367

lib/req/application.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ defmodule Req.Application do
1010
name: Req.Finch,
1111
pools: %{
1212
default: [
13-
protocols: [:http1]
13+
protocols: __default_protocols__()
1414
]
1515
}},
1616
{DynamicSupervisor, strategy: :one_for_one, name: Req.FinchSupervisor},
@@ -19,4 +19,8 @@ defmodule Req.Application do
1919

2020
Supervisor.start_link(children, strategy: :one_for_one)
2121
end
22+
23+
def __default_protocols__ do
24+
[:http1]
25+
end
2226
end

lib/req/steps.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ defmodule Req.Steps do
669669
670670
* `:timeout` - socket connect timeout in milliseconds, defaults to `30_000`.
671671
672-
* `:protocols` - the HTTP protocols to use, defaults to `[:http1]`.
672+
* `:protocols` - the HTTP protocols to use, defaults to `#{inspect(Req.Application.__default_protocols__())}`.
673673
674674
* `:hostname` - Mint explicit hostname, see `Mint.HTTP.connect/4` for more information.
675675
@@ -1086,7 +1086,7 @@ defmodule Req.Steps do
10861086
[protocol]
10871087

10881088
true ->
1089-
[:http1, :http2]
1089+
Req.Application.__default_protocols__()
10901090
end
10911091

10921092
pool_opts = [

0 commit comments

Comments
 (0)