当我向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
}