edgurgel / httpoison

Yet Another HTTP client for Elixir powered by hackney
https://hex.pm/packages/httpoison
MIT License
2.22k stars 339 forks source link

`request!/1` invalid spec #482

Closed mjquinlan2000 closed 8 months ago

mjquinlan2000 commented 8 months ago

I upgraded to version 2.2.0 and started getting the following dialyzer error:

lib/dialyzer_test/client.ex:2: Invalid type specification for function 'Elixir.DialyzerTest.Client':'request!'/1.
 The success typing is 'Elixir.DialyzerTest.Client':'request!'(#{'__struct__':='Elixir.HTTPoison.Request', 'body':=_, 'headers':=_, 'method':='delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put', 'options':=_, 'params':=_, 'url':=binary()}) -> #{'__struct__':='Elixir.HTTPoison.AsyncResponse' | 'Elixir.HTTPoison.MaybeRedirect' | 'Elixir.HTTPoison.Response', 'body'=>_, 'headers'=>[any()], 'id'=>reference(), 'redirect_url'=>_, 'request'=>#{'__struct__':='Elixir.HTTPoison.Request', 'body':=_, 'headers':=_, 'method':='delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put', 'options':=_, 'params':=_, 'url':=binary()}, 'request_url'=>_, 'status_code'=>integer()}
 But the spec is 'Elixir.DialyzerTest.Client':'request!'('Elixir.HTTPoison.Request':t()) -> {'ok','Elixir.HTTPoison.Response':t() | 'Elixir.HTTPoison.AsyncResponse':t() | 'Elixir.HTTPoison.MaybeRedirect':t()}
 The return types do not overlap

This seems to fix it

mjquinlan2000 commented 8 months ago

Didn't see #481