-1

使用 WiFlyHQ 库我尝试发送 POST 请求,似乎请求标头被裁剪,如果我检查服务器上的请求,我可以看到以下内容:

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' },

看来,它在特定字符计数后被裁剪,不确定我在这里做错了什么......

4

1 回答 1

0

我相信记忆是问题,我遇到了同样的问题。我正在使用 VS 2012 构建我的应用程序,当它达到 60% 时,它往往会偶尔出现。

于 2013-01-04T18:42:31.170 回答