向Google Script发送的Http发布请求导致需要411个错误长度

时间:2019-03-06 12:39:57

标签: http google-apps-script at-command

我正在使用AT Command(类似于C或C ++)向Google Script发送发布请求,以在其中保存数据。我收到说411错误的错误。

这是发送的代码:

AT+CHTTPACT="script.google.com",80

//Wait for the +CHTTPACT: REQUEST from the module
WAIT=1

POST script.google.com HTTP/1.1<cr><lf>
Host: script.google.com/macros/s/AKfycbwALy3GCY_r5fNOzxzut_RnbDR01Caq83MmsLPRuxoE5EQ7mUE/exec\r\nContent-Length: 0\r\nContent-Type: json/application<cr><lf>

<cr><lf>^z<cr><lf>

这是错误:

+CHTTPACT: DATA,1408
http/1.0 411 length required
content-type: text/html; charset=utf-8
referrer-policy: no-referrer
content-length: 1564
date: wed, 06 mar 2019 12:36:35 gmt

<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 411 (Length Required)!!1</title>
  <style>
_150x54dp.png) no-repeat
+CHTTPACT: DATA,317
;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>411.</b> <ins>That’s an error.</ins>
  <p>POST requests require a <code>Content-length</code> header.  <ins>That’s all we know.</ins>

+CHTTPACT: 0

我让它与我自己的Node JS服务器一起工作,但是我需要它与json主体一起工作,以便它可以与Google和其他云服务器一起工作:

AT+CHTTPACT="59.102.xx.xxx",3000

//Wait for the +CHTTPACT: REQUEST from the module
WAIT=1


POST http://59.102.xx.xxx HTTP/1.1<cr><lf>
Host: http://59.102.xx.xxx:3000<cr><lf>
Content-Type: text/html<cr><lf>
<cr><lf>^z<cr><lf>

0 个答案:

没有答案