当我向ESP8266请求时,为什么我的AWS API Gateway api不返回任何内容?

时间:2019-05-16 10:30:36

标签: amazon-web-services arduino

当我向ESP8266请求时,为什么我的AWS API Gateway api不返回任何东西?

这是我的代码,变量httpCode返回-1。

if (WiFi.status() == WL_CONNECTED) { //Check WiFi connection status
                      HTTPClient http;  //Declare an object of class HTTPClient

                      http.begin("https://gg71nquqt8.execute-api.us-east-1.amazonaws.com/prod/productsLambdaReal?type=GET");  //Specify request destination
                      int httpCode = http.GET();  
                      Serial.print("http");//Send the request
                      Serial.println(httpCode);
                      String payload = http.getString();   //Get the request response payload

                      if (httpCode > 0) { //Check the returning code

                      String payload = http.getString();   //Get the request response payload
                      Serial.println(payload);                     //Print the response payload

                      }

                      http.end();   //Close connection
                  }

0 个答案:

没有答案