File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 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) {
4747}
4848
4949/* *
50- * Set the influxDB port.
50+ * Set the influxDB port.
5151 * @param port v1.x uses 8086, v2 uses 9999
5252 */
5353void Influxdb::setPort (uint16_t port){
@@ -163,11 +163,23 @@ boolean Influxdb::write(String data) {
163163 Serial.print (" <-- Response: " );
164164 Serial.print (httpResponseCode);
165165
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
166177 String response = http.getString ();
167178 Serial.println (" \" " + response + " \" " );
179+ #endif
168180
169181 boolean success;
170- if (httpResponseCode == 204 ) {
182+ if (httpResponseCode == HTTP_CODE_NO_CONTENT ) {
171183 success = true ;
172184 } else {
173185 Serial.println (" #####\n POST FAILED\n #####" );
You can’t perform that action at this time.
0 commit comments