@@ -27,7 +27,8 @@ bool AdafruitIO_Dashboard::exists()
27
27
url += " /dashboards/" ;
28
28
url += name;
29
29
30
- _io->_http ->startRequest (url.c_str (), HTTP_METHOD_GET);
30
+ _io->_http ->beginRequest ();
31
+ _io->_http ->get (url.c_str ());
31
32
_io->_http ->sendHeader (" X-AIO-Key" , _io->_key );
32
33
_io->_http ->endRequest ();
33
34
@@ -46,12 +47,21 @@ bool AdafruitIO_Dashboard::create()
46
47
String body = " name=" ;
47
48
body += name;
48
49
49
- _io->_http ->startRequest (url.c_str (), HTTP_METHOD_POST);
50
- _io->_http ->sendHeader (HTTP_HEADER_CONTENT_TYPE, " application/x-www-form-urlencoded" );
51
- _io->_http ->sendHeader (HTTP_HEADER_CONTENT_LENGTH, body.length ());
50
+ _io->_http ->beginRequest ();
51
+ _io->_http ->post (url.c_str ());
52
+
53
+ _io->_http ->sendHeader (" Content-Type" , " application/x-www-form-urlencoded" );
54
+ _io->_http ->sendHeader (" Content-Length" , body.length ());
52
55
_io->_http ->sendHeader (" X-AIO-Key" , _io->_key );
56
+
57
+ // the following call to endRequest
58
+ // should be replaced by beginBody once the
59
+ // Arduino HTTP Client Library is updated
60
+ // _io->_http->beginBody();
61
+ _io->_http ->endRequest ();
62
+
63
+ _io->_http ->print (body);
53
64
_io->_http ->endRequest ();
54
- _io->_http ->write ((const byte*)body.c_str (), body.length ());
55
65
56
66
int status = _io->_http ->responseStatusCode ();
57
67
_io->_http ->responseBody (); // needs to be read even if not used
0 commit comments