由于某些原因,我似乎无法通过Restler调用DELETE方法。在我的restler php文件中,我定义了一个类似的方法:
/**
* Drop invitation
*
* Removes an invitation from the system. Coaches want a way to be able
* to remove an invite if they messed up, or the person just doesn't accept.
*
* @param string $email The email address of the invited person {@from body}
* @param int $team_id The SQL identifier for the team {@from body}
*
* @return array An empty array
*/
public function deleteInvite($email, $team_id) {
return [];
}
当我试着打电话时:
curl -X DELETE -H" Content-Type:application / json" -d' {"电子邮件":" foo"," team_id",17}' HTTP:// server.com /应用程序/团队/邀请
它返回400错误:
{ "错误":{ "代码":400, "消息":"错误请求:电子邮件丢失。" } }
我该怎么称呼这个?
答案 0 :(得分:0)
作为一种广泛接受的做法,我们不支持/阅读GET
和DELETE
请求的正文参数。将它们作为URL或作为查询字符串发送。
正如您在http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-4.3
中所看到的许多http服务器都不解析GET
和DELETE
请求的正文,restler正在遵循这种做法