File tree Expand file tree Collapse file tree 4 files changed +15
-1
lines changed Expand file tree Collapse file tree 4 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -58,8 +58,9 @@ void loop() {
5858 client.sendHeader (" Content-Type" , " application/x-www-form-urlencoded" );
5959 client.sendHeader (" Content-Length" , postData.length ());
6060 client.sendHeader (" X-Custom-Header" , " custom-header-value" );
61- client.endRequest ();
61+ client.beginBody ();
6262 client.print (postData);
63+ client.endRequest ();
6364
6465 // read the status code and body of the response
6566 statusCode = client.responseStatusCode ();
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ put KEYWORD2
2020patch KEYWORD2
2121startRequest KEYWORD2
2222beginRequest KEYWORD2
23+ beginBody KEYWORD2
2324sendHeader KEYWORD2
2425sendBasicAuth KEYWORD2
2526endRequest KEYWORD2
Original file line number Diff line number Diff line change @@ -263,6 +263,11 @@ void HttpClient::flushClientRx()
263263}
264264
265265void HttpClient::endRequest ()
266+ {
267+ beginBody ();
268+ }
269+
270+ void HttpClient::beginBody ()
266271{
267272 if (iState < eRequestSent)
268273 {
Original file line number Diff line number Diff line change @@ -62,6 +62,13 @@ class HttpClient : public Client
6262 */
6363 void endRequest ();
6464
65+ /* * Start the body of a more complex request.
66+ Use this when you need to send the body after additional headers
67+ in the request, but can optionally call endRequest() when
68+ you are finished.
69+ */
70+ void beginBody ();
71+
6572 /* * Connect to the server and start to send a GET request.
6673 @param aURLPath Url to request
6774 @return 0 if successful, else error
You can’t perform that action at this time.
0 commit comments