Skip to content

Commit

Permalink
run_finch: Fix defaulting to using just HTTP/1
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmach committed Jun 24, 2024
1 parent 7148e42 commit af1a34f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/req.ex
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ defmodule Req do
* `:timeout` - socket connect timeout in milliseconds, defaults to `30_000`.
* `:protocols` - the HTTP protocols to use, defaults to `[:http1]`.
* `:protocols` - the HTTP protocols to use, defaults to `#{inspect(Req.Application.__default_protocols__())}`.
* `:hostname` - Mint explicit hostname.
Expand Down
6 changes: 5 additions & 1 deletion lib/req/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule Req.Application do
name: Req.Finch,
pools: %{
default: [
protocols: [:http1]
protocols: __default_protocols__()
]
}},
{DynamicSupervisor, strategy: :one_for_one, name: Req.FinchSupervisor},
Expand All @@ -19,4 +19,8 @@ defmodule Req.Application do

Supervisor.start_link(children, strategy: :one_for_one)
end

def __default_protocols__ do
[:http1]
end
end
4 changes: 2 additions & 2 deletions lib/req/steps.ex
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ defmodule Req.Steps do
* `:timeout` - socket connect timeout in milliseconds, defaults to `30_000`.
* `:protocols` - the HTTP protocols to use, defaults to `[:http1]`.
* `:protocols` - the HTTP protocols to use, defaults to `#{inspect(Req.Application.__default_protocols__())}`.
* `:hostname` - Mint explicit hostname, see `Mint.HTTP.connect/4` for more information.
Expand Down Expand Up @@ -1086,7 +1086,7 @@ defmodule Req.Steps do
[protocol]

true ->
[:http1, :http2]
Req.Application.__default_protocols__()
end

pool_opts = [
Expand Down

0 comments on commit af1a34f

Please sign in to comment.