Skip to content

Commit c9dc8e1

Browse files
joextoddigrr
authored andcommitted
ESP8266HTTPClient: Add PATCH request (#3590)
1 parent 1683b12 commit c9dc8e1

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,20 @@ int HTTPClient::PUT(String payload) {
351351
return PUT((uint8_t *) payload.c_str(), payload.length());
352352
}
353353

354+
/**
355+
* sends a patch request to the server
356+
* @param payload uint8_t *
357+
* @param size size_t
358+
* @return http code
359+
*/
360+
int HTTPClient::PATCH(uint8_t * payload, size_t size) {
361+
return sendRequest("PATCH", payload, size);
362+
}
363+
364+
int HTTPClient::PATCH(String payload) {
365+
return PATCH((uint8_t *) payload.c_str(), payload.length());
366+
}
367+
354368
/**
355369
* sendRequest
356370
* @param type const char * "GET", "POST", ....

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ class HTTPClient
158158
int POST(String payload);
159159
int PUT(uint8_t * payload, size_t size);
160160
int PUT(String payload);
161+
int PATCH(uint8_t * payload, size_t size);
162+
int PATCH(String payload);
161163
int sendRequest(const char * type, String payload);
162164
int sendRequest(const char * type, uint8_t * payload = NULL, size_t size = 0);
163165
int sendRequest(const char * type, Stream * stream, size_t size = 0);

0 commit comments

Comments
 (0)