Skip to content

Commit

Permalink
Extract private Req.Finch (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmach authored Jun 27, 2024
1 parent 5353c4f commit 7ee7fd8
Show file tree
Hide file tree
Showing 5 changed files with 461 additions and 387 deletions.
5 changes: 4 additions & 1 deletion lib/req.ex
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ defmodule Req do
@req Req.Request.new()
|> Req.Steps.attach()

@default_finch_options Req.Finch.pool_options(%{})

@doc """
Returns a new request struct with built-in steps.
Expand Down Expand Up @@ -361,7 +363,8 @@ defmodule Req do
* `:timeout` - socket connect timeout in milliseconds, defaults to `30_000`.
* `:protocols` - the HTTP protocols to use, defaults to `#{inspect(Req.Application.__default_protocols__())}`.
* `:protocols` - the HTTP protocols to use, defaults to
`#{inspect(Keyword.fetch!(@default_finch_options, :protocols))}`.
* `:hostname` - Mint explicit hostname.
Expand Down
8 changes: 1 addition & 7 deletions lib/req/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,12 @@ defmodule Req.Application do
{Finch,
name: Req.Finch,
pools: %{
default: [
protocols: __default_protocols__()
]
default: Req.Finch.pool_options(%{})
}},
{DynamicSupervisor, strategy: :one_for_one, name: Req.FinchSupervisor},
{Req.Test.Ownership, name: Req.Test.Ownership}
]

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

def __default_protocols__ do
[:http1]
end
end
Loading

0 comments on commit 7ee7fd8

Please sign in to comment.