File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,12 +75,21 @@ bool AdafruitIO_Block::save()
7575 body += block_feeds;
7676 body += " }" ;
7777
78- http->startRequest (url.c_str (), HTTP_METHOD_POST);
79- http->sendHeader (HTTP_HEADER_CONTENT_TYPE, " application/json" );
80- http->sendHeader (HTTP_HEADER_CONTENT_LENGTH, body.length ());
78+ http->beginRequest ();
79+ http->post (url.c_str ());
80+
81+ http->sendHeader (" Content-Type" , " application/json" );
82+ http->sendHeader (" Content-Length" , body.length ());
8183 http->sendHeader (" X-AIO-Key" , _dashboard->io ()->_key );
84+
85+ // the following call to endRequest
86+ // should be replaced by beginBody once the
87+ // Arduino HTTP Client Library is updated
88+ // http->beginBody();
89+ http->endRequest ();
90+
91+ http->print (body);
8292 http->endRequest ();
83- http->write ((const byte*)body.c_str (), body.length ());
8493
8594 int status = http->responseStatusCode ();
8695 http->responseBody (); // needs to be read even if not used
You can’t perform that action at this time.
0 commit comments