File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change 3434
3535#include " TestSupport.h"
3636
37+ static HTTPClient httpClient;
3738
3839void printFreeHeap () {
3940 Serial.print (" [TD] Free heap: " );
4041 Serial.println (ESP.getFreeHeap ());
4142}
4243
4344int httpPOST (String url, String mess) {
44- HTTPClient http;
45- http.setReuse (false );
45+ httpClient.setReuse (false );
4646 int code = 0 ;
47- if (http .begin (url)) {
48- code = http .POST (mess);
49- http .end ();
47+ if (httpClient .begin (url)) {
48+ code = httpClient .POST (mess);
49+ httpClient .end ();
5050 }
5151 return code;
5252}
5353
5454int httpGET (String url) {
55- HTTPClient http;
56- http.setReuse (false );
55+ httpClient.setReuse (false );
5756 int code = 0 ;
58- if (http .begin (url)) {
59- code = http .GET ();
57+ if (httpClient .begin (url)) {
58+ code = httpClient .GET ();
6059 if (code != 204 ) {
6160 // Serial.print("[TD] ");
6261 // String res = http.getString();
6362 // Serial.println(res);
6463 }
65- http .end ();
64+ httpClient .end ();
6665 }
6766 return code;
6867}
You can’t perform that action at this time.
0 commit comments