【发布时间】:2018-03-01 16:10:26
【问题描述】:
它说我的参数中有一个意外的标记。
"ActionDispatch::Http::Parameters::ParseError: 765: unexpected token at 'conversation_identifier[participant_list][]=2&conversation_identifier[participant_list][]=1"
为了清楚起见,带有幻数的测试版本:
let(:headers) do
{ 'HTTP_CURRENT_USER_ID' => 2,
'Content-Type' => 'application/json' }
end
let(:params) { { conversation_identifier: { participant_list: [1, 2] } }
it 'is getting testy' do
post resource_url, params: params, headers: headers
assert_equal 201, response.status
end
这就是奇怪的地方。如果我不给它标题,解析这些参数就没有问题。
【问题讨论】: