File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -75,12 +75,21 @@ bool AdafruitIO_Block::save()
75
75
body += block_feeds;
76
76
body += " }" ;
77
77
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 ());
81
83
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);
82
92
http->endRequest ();
83
- http->write ((const byte*)body.c_str (), body.length ());
84
93
85
94
int status = http->responseStatusCode ();
86
95
http->responseBody (); // needs to be read even if not used
You can’t perform that action at this time.
0 commit comments