@@ -27,7 +27,8 @@ bool AdafruitIO_Dashboard::exists()
2727 url += " /dashboards/" ;
2828 url += name;
2929
30- _io->_http ->startRequest (url.c_str (), HTTP_METHOD_GET);
30+ _io->_http ->beginRequest ();
31+ _io->_http ->get (url.c_str ());
3132 _io->_http ->sendHeader (" X-AIO-Key" , _io->_key );
3233 _io->_http ->endRequest ();
3334
@@ -46,12 +47,21 @@ bool AdafruitIO_Dashboard::create()
4647 String body = " name=" ;
4748 body += name;
4849
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 ());
5255 _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);
5364 _io->_http ->endRequest ();
54- _io->_http ->write ((const byte*)body.c_str (), body.length ());
5565
5666 int status = _io->_http ->responseStatusCode ();
5767 _io->_http ->responseBody (); // needs to be read even if not used
0 commit comments