File tree 1 file changed +14
-2
lines changed 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ void Influxdb::setBucket(String bucket) {
47
47
}
48
48
49
49
/* *
50
- * Set the influxDB port.
50
+ * Set the influxDB port.
51
51
* @param port v1.x uses 8086, v2 uses 9999
52
52
*/
53
53
void Influxdb::setPort (uint16_t port){
@@ -163,11 +163,23 @@ boolean Influxdb::write(String data) {
163
163
Serial.print (" <-- Response: " );
164
164
Serial.print (httpResponseCode);
165
165
166
+ #if defined(ESP32)
167
+ // The ESP32 HTTP Lib seems to hang if you call getString if the server has not
168
+ // written anything in response.
169
+ if (http.getSize () > 0 ) {
170
+ String response = http.getString ();
171
+ Serial.println (" \" " + response + " \" " );
172
+ }
173
+ else {
174
+ Serial.println ();
175
+ }
176
+ #else
166
177
String response = http.getString ();
167
178
Serial.println (" \" " + response + " \" " );
179
+ #endif
168
180
169
181
boolean success;
170
- if (httpResponseCode == 204 ) {
182
+ if (httpResponseCode == HTTP_CODE_NO_CONTENT ) {
171
183
success = true ;
172
184
} else {
173
185
Serial.println (" #####\n POST FAILED\n #####" );
You can’t perform that action at this time.
0 commit comments