Twitter-compatible API - RESTfulness checks as per Twitter

darcs-hash:20080819214923-462f3-83ab492cb93c1ba643beb70853578cbd7ac35d61.gz
This commit is contained in:
zach 2008-08-19 17:49:23 -04:00
parent 9c29b9ad62
commit 0b87bf6c54
3 changed files with 21 additions and 0 deletions

View File

@ -61,6 +61,11 @@ class TwitapiaccountAction extends TwitterapiAction {
function update_location($args, $apidata) {
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
exit();
}
$location = trim($this->arg('location'));
if (!is_null($location) && strlen($location) > 255) {

View File

@ -40,6 +40,11 @@ class TwitapifriendshipsAction extends TwitterapiAction {
function create($args, $apidata) {
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
exit();
}
$id = $apidata['api_arg'];
$other = $this->get_user($id);
@ -98,6 +103,12 @@ class TwitapifriendshipsAction extends TwitterapiAction {
function destroy($args, $apidata) {
parent::handle($args);
if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
$this->client_error(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
exit();
}
$id = $apidata['api_arg'];
# We can't subscribe to a remote person, but we can unsub

View File

@ -374,6 +374,11 @@ class TwitapistatusesAction extends TwitterapiAction {
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
$this->client_error(_('This method requires a POST.'), 400, $apidata['content-type']);
exit();
}
$user = $apidata['user'];
$status = $this->trimmed('status');
$source = $this->trimmed('source');