1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-25 20:02:37 +03:00

Added PUT Request to HTTP Client (#2310)

* Added PUT Request to HTTP Client

* Replaced Tabstops with spaces
This commit is contained in:
Fabian Desoye 2016-07-26 12:23:38 +02:00 committed by Ivan Grokhotkov
parent 4dc4e75216
commit 3fc3e9a99d
2 changed files with 16 additions and 0 deletions

View File

@ -338,6 +338,20 @@ int HTTPClient::POST(String payload)
return POST((uint8_t *) payload.c_str(), payload.length()); return POST((uint8_t *) payload.c_str(), payload.length());
} }
/**
* sends a put request to the server
* @param payload uint8_t *
* @param size size_t
* @return http code
*/
int HTTPClient::PUT(uint8_t * payload, size_t size) {
return sendRequest("PUT", payload, size);
}
int HTTPClient::PUT(String payload) {
return POST((uint8_t *) payload.c_str(), payload.length());
}
/** /**
* sendRequest * sendRequest
* @param type const char * "GET", "POST", .... * @param type const char * "GET", "POST", ....

View File

@ -156,6 +156,8 @@ public:
int GET(); int GET();
int POST(uint8_t * payload, size_t size); int POST(uint8_t * payload, size_t size);
int POST(String payload); int POST(String payload);
int PUT(uint8_t * payload, size_t size);
int PUT(String payload);
int sendRequest(const char * type, String payload); int sendRequest(const char * type, String payload);
int sendRequest(const char * type, uint8_t * payload = NULL, size_t size = 0); int sendRequest(const char * type, uint8_t * payload = NULL, size_t size = 0);
int sendRequest(const char * type, Stream * stream, size_t size = 0); int sendRequest(const char * type, Stream * stream, size_t size = 0);