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 34
34
35
35
#include " TestSupport.h"
36
36
37
+ static HTTPClient httpClient;
37
38
38
39
void printFreeHeap () {
39
40
Serial.print (" [TD] Free heap: " );
40
41
Serial.println (ESP.getFreeHeap ());
41
42
}
42
43
43
44
int httpPOST (String url, String mess) {
44
- HTTPClient http;
45
- http.setReuse (false );
45
+ httpClient.setReuse (false );
46
46
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 ();
50
50
}
51
51
return code;
52
52
}
53
53
54
54
int httpGET (String url) {
55
- HTTPClient http;
56
- http.setReuse (false );
55
+ httpClient.setReuse (false );
57
56
int code = 0 ;
58
- if (http .begin (url)) {
59
- code = http .GET ();
57
+ if (httpClient .begin (url)) {
58
+ code = httpClient .GET ();
60
59
if (code != 204 ) {
61
60
// Serial.print("[TD] ");
62
61
// String res = http.getString();
63
62
// Serial.println(res);
64
63
}
65
- http .end ();
64
+ httpClient .end ();
66
65
}
67
66
return code;
68
67
}
You can’t perform that action at this time.
0 commit comments