Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 448a152

Browse filesBrowse files
committed
Add new beginBody API
1 parent 2394bbb commit 448a152
Copy full SHA for 448a152

File tree

Expand file treeCollapse file tree

4 files changed

+15
-1
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+15
-1
lines changed

‎examples/PostWithHeaders/PostWithHeaders.ino

Copy file name to clipboardExpand all lines: examples/PostWithHeaders/PostWithHeaders.ino
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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();

‎keywords.txt

Copy file name to clipboardExpand all lines: keywords.txt
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ put KEYWORD2
2020
patch KEYWORD2
2121
startRequest KEYWORD2
2222
beginRequest KEYWORD2
23+
beginBody KEYWORD2
2324
sendHeader KEYWORD2
2425
sendBasicAuth KEYWORD2
2526
endRequest KEYWORD2

‎src/HttpClient.cpp

Copy file name to clipboardExpand all lines: src/HttpClient.cpp
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ void HttpClient::flushClientRx()
263263
}
264264

265265
void HttpClient::endRequest()
266+
{
267+
beginBody();
268+
}
269+
270+
void HttpClient::beginBody()
266271
{
267272
if (iState < eRequestSent)
268273
{

‎src/HttpClient.h

Copy file name to clipboardExpand all lines: src/HttpClient.h
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.