|
24 | 24 |
|
25 | 25 | #include "defines.h" |
26 | 26 |
|
27 | | -#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.2.0" |
28 | | -#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1002000 |
| 27 | +#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN_TARGET "Portenta_H7_AsyncHTTPRequest v1.3.0" |
| 28 | +#define PORTENTA_H7_ASYNC_HTTP_REQUEST_VERSION_MIN 1003000 |
29 | 29 |
|
30 | 30 | // Select a test server address |
31 | 31 | const char POST_ServerAddress[] = "dweet.io"; |
@@ -107,23 +107,34 @@ void requestCB(void* optParm, AsyncHTTPRequest* request, int readyState) |
107 | 107 |
|
108 | 108 | if (readyState == readyStateDone) |
109 | 109 | { |
110 | | - String responseText = request->responseText(); |
111 | | - |
112 | | - Serial.println("\n**************************************"); |
113 | | - //Serial.println(request->responseText()); |
114 | | - Serial.println(responseText); |
115 | | - Serial.println("**************************************"); |
| 110 | + Serial.println(); |
| 111 | + AHTTP_LOGWARN(F("\n**************************************")); |
| 112 | + AHTTP_LOGWARN1(F("Response Code = "), request->responseHTTPString()); |
116 | 113 |
|
117 | | - parseResponse(responseText); |
| 114 | + if (request->responseHTTPcode() == 200) |
| 115 | + { |
| 116 | + String responseText = request->responseText(); |
118 | 117 |
|
119 | | - request->setDebug(false); |
| 118 | + Serial.println("\n**************************************"); |
| 119 | + //Serial.println(request->responseText()); |
| 120 | + Serial.println(responseText); |
| 121 | + Serial.println("**************************************"); |
| 122 | + |
| 123 | + parseResponse(responseText); |
| 124 | + |
| 125 | + request->setDebug(false); |
| 126 | + } |
| 127 | + else |
| 128 | + { |
| 129 | + AHTTP_LOGERROR(F("Response error")); |
| 130 | + } |
120 | 131 | } |
121 | 132 | } |
122 | 133 |
|
123 | 134 | void setup() |
124 | 135 | { |
125 | 136 | Serial.begin(115200); |
126 | | - while (!Serial); |
| 137 | + while (!Serial && millis() < 5000); |
127 | 138 |
|
128 | 139 | Serial.print("\nStart AsyncDweetPOST on "); Serial.println(BOARD_NAME); |
129 | 140 | Serial.println(PORTENTA_H7_ASYNC_TCP_VERSION); |
|
0 commit comments