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

Streaming requests #1143

Merged
merged 11 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename requestStreaming -> requestStream
  • Loading branch information
richardm-stripe committed Jun 26, 2021
commit 791d2a2e9b8223d2da323e46d65d554c985e0110
4 changes: 2 additions & 2 deletions lib/ApiOperations/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function _request($method, $url, $params = [], $options = null)
*
* @return array tuple containing (the JSON response, $options)
*/
protected function _requestStreaming($method, $url, $readBodyChunk, $params = [], $options = null)
protected function _requestStream($method, $url, $readBodyChunk, $params = [], $options = null)
{
$opts = $this->_opts->merge($options);
static::_staticStreamingRequest($method, $url, $readBodyChunk, $params, $opts);
Expand Down Expand Up @@ -97,6 +97,6 @@ protected static function _staticStreamingRequest($method, $url, $readBodyChunk,
$opts = \Stripe\Util\RequestOptions::parse($options);
$baseUrl = isset($opts->apiBase) ? $opts->apiBase : static::baseUrl();
$requestor = new \Stripe\ApiRequestor($opts->apiKey, $baseUrl);
$requestor->requestStreaming($method, $url, $readBodyChunk, $params, $opts->headers);
$requestor->requestStream($method, $url, $readBodyChunk, $params, $opts->headers);
}
}
4 changes: 2 additions & 2 deletions lib/ApiRequestor.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function request($method, $url, $params = null, $headers = null)
*
* @return array tuple containing (ApiReponse, API key)
*/
public function requestStreaming($method, $url, $readBodyChunk, $params = null, $headers = null)
public function requestStream($method, $url, $readBodyChunk, $params = null, $headers = null)
{
$params = $params ?: [];
$headers = $headers ?: [];
Expand Down Expand Up @@ -485,7 +485,7 @@ private function _requestRawStreaming($method, $url, $params, $headers, $readBod

$requestStartMs = Util\Util::currentTimeMillis();

list($rbody, $rcode, $rheaders) = $this->httpClient()->requestStreaming(
list($rbody, $rcode, $rheaders) = $this->httpClient()->requestStream(
$method,
$absUrl,
$rawHeaders,
Expand Down
2 changes: 1 addition & 1 deletion lib/HttpClient/CurlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public function request($method, $absUrl, $headers, $params, $hasFile)
return [$rbody, $rcode, $rheaders];
}

public function requestStreaming($method, $absUrl, $headers, $params, $hasFile, $readBodyChunk)
public function requestStream($method, $absUrl, $headers, $params, $hasFile, $readBodyChunk)
{
list($opts, $absUrl) = $this->constructRequest($method, $absUrl, $headers, $params, $hasFile);

Expand Down
4 changes: 2 additions & 2 deletions tests/Stripe/ApiResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Stripe;

// Fake resource that calls GET /v1/coupons/{coupon} but using
// _requestStreaming to test the _requestStreaming interface.
// _requestStream to test the _requestStream interface.

class FooResource extends ApiResource
{
Expand All @@ -13,7 +13,7 @@ class FooResource extends ApiResource
public function pdf($readBodyChunk, $params = null, $opts = null)
{
$url = $this->instanceUrl();
list($opts) = $this->_requestStreaming('get', $url, $readBodyChunk, $params, $opts);
list($opts) = $this->_requestStream('get', $url, $readBodyChunk, $params, $opts);

return $this;
}
Expand Down