Skip to content

Commit

Permalink
Twitter Labs のメソッドのURLにも対応させる
Browse files Browse the repository at this point in the history
  • Loading branch information
Masafumi Konishi committed Mar 5, 2020
1 parent 8def6b2 commit ef948db
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/TwitterOAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,29 @@ private function http($method, $host, $path, array $parameters, $json)
{
$this->resetLastResponse();
$this->resetAttemptsNumber();
$url = sprintf('%s/%s/%s.json', $host, self::API_VERSION, $path);
$url = $this->getUrl($host, $path);
$this->response->setApiPath($path);
if (!$json) {
$parameters = $this->cleanUpParameters($parameters);
}
return $this->makeRequests($url, $method, $parameters, $json);
}

/**
* Twitter Labs のメソッドに対応させる
*
* @param $host
* @param $path
* @return string
*/
private function getUrl($host, $path)
{
if (strpos($path, 'labs') === 0) {
return $host . '/' . $path;
}
return sprintf('%s/%s/%s.json', $host, self::API_VERSION, $path);
}

/**
*
* Make requests and retry them (if enabled) in case of Twitter's problems.
Expand Down

0 comments on commit ef948db

Please sign in to comment.