Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: sending JSON or multipart requests #995

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Mar 25, 2023

  1. Fix: sending JSON or multipart requests

    Sending url-encoded params, json or multipart requests with Guzzle is easy, because shortcuts are implemented within [`GuzzleHttp\Client::applyOptions()`](https://github.com/guzzle/guzzle/blob/7.5.0/src/Client.php#L340).
    
    Currently, those shortcuts are unreachable through the League OAuth2 Client, and thus all its providers.
    
    This fix relies on `AbstractProvider::getResponse()`, and does not affect `AbstractProvider::getAuthenticatedRequest()`.
    
    `GuzzleHttp\ClientInterface::send()` method supports a second optional `$options` parameter [since v6.0](guzzle/guzzle@1a9ad6b?diff=split#diff-7fe9d7bab1528c58fb39365621c6f02430dd01828c26fe8b00f0408de72c71b8).
    
    Upgrading `AbstractProvider::getResponse()` to support this second optional parameter allows the developper to use a `"form_params"`, `"json"` or `"multipart"` option key :
    ```php
    $options = ['multipart' => $multipart];
    $request = $oauth2client->getAuthenticatedRequest($method, $url, $token);
    $response = $oauth2client->getResponse($request, $options);
    ```
    fverry authored Mar 25, 2023
    Configuration menu
    Copy the full SHA
    a080e3b View commit details
    Browse the repository at this point in the history

Commits on Apr 16, 2023

  1. Configuration menu
    Copy the full SHA
    d8adc92 View commit details
    Browse the repository at this point in the history