PUT http请求查询
PUT http request query
实际上我正在尝试将 PUT 请求发送到远程服务器请求已成功发送到远程服务器但不幸的是该请求被认为是错误的请求它看不到请求的正文我希望我的描述清楚这是用 Arduino 编程语言发送请求的代码:
Serial.println("Sending to Server: ");
client.print("PUT /***/***/sensor/uod/1/A/1 HTTP/1.1\n");
Serial.print("PUT /***/***/sensor/uod/1/A/1 HTTP/1.1");
client.print("Host: ********.koding.io\n");
client.print("Cache-Control: no-cache\n");
client.print("Content-Type: application/x-www-form-urlencoded\r\n\r\n");
client.print("status=1");
有一件事我想提一下,我在服务器端使用了一个叫做 postman 的工具,它成功地工作,没有任何错误,实际上我已经接受了它的 http 请求并将其转换为要发送的代码您可以在下面找到 http 请求:
PUT /***/***/sensor/uod/1/A/1 HTTP/1.1
Host: *******.koding.io
Cache-Control: no-cache
Postman-Token: 8740ccb4-c0f2-a916-fd52-3089e4f3cbc9
Content-Type: application/x-www-form-urlencoded
status=0
我已经通过添加 content-Length: 10 header
解决了问题
Serial.println("Sending to Server: ");
client.print("PUT /***/***/sensor/uod/1/A/1 HTTP/1.1\n");
Serial.print("PUT /***/***/sensor/uod/1/A/1 HTTP/1.1");
client.print("Host: *********.koding.io\n");
client.print("Cache-Control: no-cache\n");
client.print("Content-Type: application/x-www-form-urlencoded\r\n");
client.print("Content-Length: 10\r\n\r\n");
client.print("status=1\r\n");
实际上我正在尝试将 PUT 请求发送到远程服务器请求已成功发送到远程服务器但不幸的是该请求被认为是错误的请求它看不到请求的正文我希望我的描述清楚这是用 Arduino 编程语言发送请求的代码:
Serial.println("Sending to Server: ");
client.print("PUT /***/***/sensor/uod/1/A/1 HTTP/1.1\n");
Serial.print("PUT /***/***/sensor/uod/1/A/1 HTTP/1.1");
client.print("Host: ********.koding.io\n");
client.print("Cache-Control: no-cache\n");
client.print("Content-Type: application/x-www-form-urlencoded\r\n\r\n");
client.print("status=1");
有一件事我想提一下,我在服务器端使用了一个叫做 postman 的工具,它成功地工作,没有任何错误,实际上我已经接受了它的 http 请求并将其转换为要发送的代码您可以在下面找到 http 请求:
PUT /***/***/sensor/uod/1/A/1 HTTP/1.1
Host: *******.koding.io
Cache-Control: no-cache
Postman-Token: 8740ccb4-c0f2-a916-fd52-3089e4f3cbc9
Content-Type: application/x-www-form-urlencoded
status=0
我已经通过添加 content-Length: 10 header
解决了问题Serial.println("Sending to Server: ");
client.print("PUT /***/***/sensor/uod/1/A/1 HTTP/1.1\n");
Serial.print("PUT /***/***/sensor/uod/1/A/1 HTTP/1.1");
client.print("Host: *********.koding.io\n");
client.print("Cache-Control: no-cache\n");
client.print("Content-Type: application/x-www-form-urlencoded\r\n");
client.print("Content-Length: 10\r\n\r\n");
client.print("status=1\r\n");