Software Version
8.7.0 (also reproducible on 8.8.0)
Language Version
PHP 8.1
Operating System
AWS Linux
What happened?
- Create an EasyPostClient and call $client->betaRate->retrieveStatelessRates($payload).
- With guzzlehttp/guzzle 7.11+, PHP emits an E_USER_DEPRECATED warning:
"Passing a non-uppercase HTTP method to Client::request() is deprecated; guzzlehttp/guzzle 8.0 will preserve HTTP method casing."
- Stack trace points to EasyPost\Http\Requestor::requestRaw() calling $client->httpClient->request($method, ...), where $method is lowercase (e.g. 'post').
- BetaRateService::retrieveStatelessRates() calls Requestor::request($this->client, 'post', '/rates', ...).
- The API call still succeeds, but the deprecation is surfaced to the application (e.g. in CakePHP dev error output mixed into API responses).
- Reproduces on every EasyPost HTTP request that uses lowercase method strings across the SDK (post, get, put, delete, patch).
What was expected?
Requestor should pass uppercase HTTP methods (POST, GET, etc.) to Guzzle's Client::request() and Client::requestAsync(), or uppercase the method before delegating.
guzzle/guzzle@f050dce
Sample Code
<?php
use EasyPost\EasyPostClient;
$client = new EasyPostClient('EASYPOST_API_KEY');
$payload = [
'to_address' => [
'street1' => '417 Montgomery Street',
'city' => 'San Francisco',
'state' => 'CA',
'zip' => '94104',
'country' => 'US',
],
'from_address' => [
'street1' => '179 N Harbor Dr',
'city' => 'Redondo Beach',
'state' => 'CA',
'zip' => '90277',
'country' => 'US',
],
'parcel' => [
'length' => 10,
'width' => 8,
'height' => 4,
'weight' => 15.4,
],
];
// Triggers deprecation with guzzlehttp/guzzle >= 7.11
$rates = $client->betaRate->retrieveStatelessRates($payload);
Relevant logs
Deprecated (16384): Since guzzlehttp/guzzle 7.11: Passing a non-uppercase HTTP method to Client::request() is deprecated; guzzlehttp/guzzle 8.0 will preserve HTTP method casing. Pass an uppercase method explicitly if uppercase is required.
Stack trace (abbreviated):
GuzzleHttp\Client::request() - guzzlehttp/guzzle/src/Client.php, line 223
EasyPost\Http\Requestor::requestRaw() - lib/EasyPost/Http/Requestor.php, line 185
EasyPost\Http\Requestor::request() - lib/EasyPost/Http/Requestor.php, line 111
EasyPost\Service\BetaRateService::retrieveStatelessRates() - lib/EasyPost/Service/BetaRateService.php, line 25
Software Version
8.7.0 (also reproducible on 8.8.0)
Language Version
PHP 8.1
Operating System
AWS Linux
What happened?
"Passing a non-uppercase HTTP method to Client::request() is deprecated; guzzlehttp/guzzle 8.0 will preserve HTTP method casing."
What was expected?
Requestor should pass uppercase HTTP methods (POST, GET, etc.) to Guzzle's Client::request() and Client::requestAsync(), or uppercase the method before delegating.
guzzle/guzzle@f050dce
Sample Code
Relevant logs