more clean up

This commit is contained in:
Alexander Strizhakov 2020-03-13 09:37:57 +03:00
commit 98ed0d1c4b
No known key found for this signature in database
GPG key ID: 022896A53AEF1381
7 changed files with 21 additions and 22 deletions

View file

@ -3,11 +3,11 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.ReverseProxy.Client.Tesla do
@behaviour Pleroma.ReverseProxy.Client
@type headers() :: [{String.t(), String.t()}]
@type status() :: pos_integer()
@behaviour Pleroma.ReverseProxy.Client
@spec request(atom(), String.t(), headers(), String.t(), keyword()) ::
{:ok, status(), headers}
| {:ok, status(), headers, map()}
@ -18,7 +18,7 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do
def request(method, url, headers, body, opts \\ []) do
check_adapter()
opts = Keyword.merge(opts, body_as: :chunks)
opts = Keyword.put(opts, :body_as, :chunks)
with {:ok, response} <-
Pleroma.HTTP.request(
@ -39,7 +39,8 @@ defmodule Pleroma.ReverseProxy.Client.Tesla do
end
@impl true
@spec stream_body(map()) :: {:ok, binary(), map()} | {:error, atom() | String.t()} | :done
@spec stream_body(map()) ::
{:ok, binary(), map()} | {:error, atom() | String.t()} | :done | no_return()
def stream_body(%{pid: pid, opts: opts, fin: true}) do
# if connection was reused, but in tesla were redirects,
# tesla returns new opened connection, which must be closed manually

View file

@ -59,7 +59,7 @@ defmodule Pleroma.ReverseProxy do
* `req_headers`, `resp_headers` additional headers.
* `http`: options for [gun](https://github.com/ninenines/gun).
* `http`: options for [hackney](https://github.com/benoitc/hackney) or [gun](https://github.com/ninenines/gun).
"""
@default_options [pool: :media]