From ebe6fb5d5ec82771e5d88373f3312ae8346e29a8 Mon Sep 17 00:00:00 2001 From: Robin Boers Date: Fri, 28 Jul 2023 11:44:19 +0200 Subject: [PATCH] Fix typespecs for some functions --- lib/req.ex | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/req.ex b/lib/req.ex index 3a69a17b..acb80fd4 100644 --- a/lib/req.ex +++ b/lib/req.ex @@ -383,6 +383,12 @@ defmodule Req do @doc """ Makes a GET request. + `request` can be one of: + + * a `String` or `URI`; + * a `Keyword` options; + * a `Req.Request` struct + See `new/1` for a list of available options. ## Examples @@ -407,7 +413,7 @@ defmodule Req do 200 """ - @spec get(url() | Req.Request.t(), options :: keyword()) :: + @spec get(url() | keyword() | Req.Request.t(), options :: keyword()) :: {:ok, Req.Response.t()} | {:error, Exception.t()} def get(request, options \\ []) @@ -591,7 +597,7 @@ defmodule Req do iex> resp.body["data"] "hello!" """ - @spec post(url() | Req.Request.t(), options :: keyword()) :: + @spec post(url() | keyword() | Req.Request.t(), options :: keyword()) :: {:ok, Req.Response.t()} | {:error, Exception.t()} def post(request, options \\ []) @@ -676,7 +682,7 @@ defmodule Req do iex> resp.body["data"] "hello!" """ - @spec put(url() | Req.Request.t(), options :: keyword()) :: + @spec put(url() | keyword() | Req.Request.t(), options :: keyword()) :: {:ok, Req.Response.t()} | {:error, Exception.t()} def put(request, options \\ []) @@ -761,7 +767,7 @@ defmodule Req do iex> resp.body["data"] "hello!" """ - @spec patch(url() | Req.Request.t(), options :: keyword()) :: + @spec patch(url() | keyword() | Req.Request.t(), options :: keyword()) :: {:ok, Req.Response.t()} | {:error, Exception.t()} def patch(url_or_request, options \\ [])