You've already forked ArduinoHttpClient
mirror of
https://github.com/arduino-libraries/ArduinoHttpClient.git
synced 2025-06-16 02:21:40 +03:00
Add optional content type, content length and body parameters to post, put, and startRequest
Also, flush client RX data in start request, if state is ready body.
This commit is contained in:
@ -50,14 +50,10 @@ void setup() {
|
||||
|
||||
void loop() {
|
||||
Serial.println("making PUT request");
|
||||
String contentType = "application/x-www-form-urlencoded";
|
||||
String putData = "name=light&age=46";
|
||||
|
||||
client.beginRequest();
|
||||
client.put("/");
|
||||
client.sendHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
client.sendHeader("Content-Length", putData.length());
|
||||
client.endRequest();
|
||||
client.write((const byte*)putData.c_str(), putData.length());
|
||||
client.put("/", contentType, putData);
|
||||
|
||||
// read the status code and content length of the response
|
||||
statusCode = client.responseStatusCode();
|
||||
|
Reference in New Issue
Block a user