我送使用jQueryCodeception - POST生JSON字符串
var url = 'http://site.local/api/package/create';
var data = {
"command": "package",
"commandParameters": {
"options": [
{
"a": true
}
],
"parameters": {
"node_id": 1111,
"node_name": "Node Name"
}
}
}
$.ajax({
url: url,
type: "POST",
data: JSON.stringify(data),
contentType: "application/json",
success: function (a, b, c) {
// Do something with response
}
});
也在做類似使用的東西下面的請求郵差(瀏覽器插件)
POST
Content-Type: application/json
Payload:
{
"command": "package",
"commandParameters": {
"options": [
{
"a": true
}
],
"parameters": {
"node_id": 1111,
"node_name": "Node Name"
}
}
}
意圖是給我寄了原始JSON字符串到我的服務器,而不是讓Jquery將其轉換爲發佈數據。 如何執行Codeception一樣的,我只是不能看到它的文檔中,我只看到下面..
$I->sendAjaxPostRequest('/updateSettings', array('notifications' => true));
所以我想我想在Codeception POST請求,同時連接JSON在請求的正文中?
這工作完全適合我,謝謝! – DethRaid 2017-04-15 02:48:25