| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2394bbb commit 448a152
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,8 +58,9 @@ void loop() { | |||
| 58 | 58 | client.sendHeader("Content-Type", "application/x-www-form-urlencoded"); | |
| 59 | 59 | client.sendHeader("Content-Length", postData.length()); | |
| 60 | 60 | client.sendHeader("X-Custom-Header", "custom-header-value"); | |
| 61 | - client.endRequest(); | ||
| 61 | + client.beginBody(); | ||
| 62 | 62 | client.print(postData); | |
| 63 | + client.endRequest(); | ||
| 63 | 64 | ||
| 64 | 65 | // read the status code and body of the response | |
| 65 | 66 | statusCode = client.responseStatusCode(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,6 +20,7 @@ put KEYWORD2 | |||
| 20 | 20 | patch KEYWORD2 | |
| 21 | 21 | startRequest KEYWORD2 | |
| 22 | 22 | beginRequest KEYWORD2 | |
| 23 | + beginBody KEYWORD2 | ||
| 23 | 24 | sendHeader KEYWORD2 | |
| 24 | 25 | sendBasicAuth KEYWORD2 | |
| 25 | 26 | endRequest KEYWORD2 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -263,6 +263,11 @@ void HttpClient::flushClientRx() | |||
| 263 | 263 | } | |
| 264 | 264 | ||
| 265 | 265 | void HttpClient::endRequest() | |
| 266 | + { | ||
| 267 | + beginBody(); | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + void HttpClient::beginBody() | ||
| 266 | 271 | { | |
| 267 | 272 | if (iState < eRequestSent) | |
| 268 | 273 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -62,6 +62,13 @@ class HttpClient : public Client | |||
| 62 | 62 | */ | |
| 63 | 63 | void endRequest(); | |
| 64 | 64 | ||
| 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 | + | ||
| 65 | 72 | /** Connect to the server and start to send a GET request. | |
| 66 | 73 | @param aURLPath Url to request | |
| 67 | 74 | @return 0 if successful, else error | |
| Back | FazBrowse Home | New Git URL |
0 commit comments