Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@boonious
Copy link

The PR provides a simple fix to the following type spec issue related to OAuth2.Client.params()

The spec for OAuth2.Client.params() is currently defined as:

@type params :: %{binary => param} | Keyword.t()

However, the default value for OAuth2.Client.params() is an empty map %{}:

params: %{},

This gives rise to Hammox.TypeMatchError in tests:

 ** (Hammox.TypeMatchError) 
     1st argument value %OAuth2.Client{authorize_url: "/o/oauth2/v2/auth", client_id: "__REDACTED__", client_secret: "__REDACTED__", headers: [{"content-type", "application/x-www-form-urlencoded"}], params: %{}, redirect_uri: "__REDACTED__", ref: nil, request_opts: [], serializers: %{"application/json" => Jason}, site: "https://accounts.google.com", strategy: Auth.Strategies.Google.Mock, token: nil, token_method: :post, token_url: "__REDACTED__"} does not match 1st parameter's type OAuth2.Client.t().
       Map value %{} for key :params does not match map value type OAuth2.Client.params().
         Value %{} does not match type %{required(binary()) => OAuth2.Client.param()} | Keyword.t().

Adding %{} to the spec fixes the issue.

@yordis yordis merged commit 1e34cfc into ueberauth:master Mar 1, 2022
@boonious boonious deleted the fix-client-params-typespec-issue branch March 29, 2022 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants