-1
使用WiFlyHQ庫我嘗試發送POST請求,好像請求頭文件被裁剪,如果我檢查服務器上的請求,我可以看到以下內容:使用WiFlyHQ庫在發佈請求期間未提交請求頭文件
headers: { host: 'localhost:3000', 'content-type': 'application' },
與此設置;
void SendJasonPacket()
{
wifly.open(Server, ServerPort);
wifly.println("POST/HTTP/1.1");
wifly.println("Host: localhost:3000");
wifly.println("Content-type: application/json");
wifly.println("Accept: application/json");
wifly.println("Content-Length: 93");
wifly.println("User-Agent: easyNAM/0.0.1");
wifly.println("{'checkin':{'device_token': '122','card_token': '12312', 'timestamp': '2012-10-29T14:31:03'}}");
wifly.close();
}
我嘗試了幾個不同的頭,這就是我的了:
headers: { 'user-agent': 'easyNAM/0.0.1', accept: 'application/j' },
headers: { accept: 'application/json', 'user-agent': 'easyNAM/0' },
headers: { host: 'localhost:3000', 'content-type': 'application' },
看來,它得到之後的特定字符數裁剪,不知道我做錯了這裏...