saloon icon indicating copy to clipboard operation
saloon copied to clipboard

Add `Stringable` to OAuthConfig `set` methods.

Open avenjamin opened this issue 8 months ago • 0 comments

This PR adds |Stringable to the set methods in the OAuthConfig class that accept a string parameter.

In my use case, I'm constructing URLs using the spatie/url package and would like to be able to pass the URL directly to the setAuthorizeEndpoint() method:

$this->oauthConfig()->setAuthorizeEndpoint(
    Url::fromString('https://api.example.com/oauth2/authorize')
    ->withQueryParameters([
        'app_key' => $appKey,
        'response_type' => 'code'
    ])
);

The Url implements the Stringable __toString() method so I can either cast to a string or update Saloon to support Stringable parameters :smile:

avenjamin avatar Jun 13 '24 12:06 avenjamin