【发布时间】:2012-03-20 09:59:12
【问题描述】:
我正在编写功能测试,我需要发出 ajax 发布请求。 “CSRF 令牌无效。请尝试重新提交表单”。如何在功能测试中获取令牌?
$crawler = $this->client->request(
'POST',
$url,
array(
'element_add' => array(
'_token' => '????',
'name' => 'bla',
)
),
array(),
array('HTTP_X-Requested-With' => 'XMLHttpRequest')
);
【问题讨论】:
标签: testing symfony csrf-protection