Skip to content

Commit

Permalink
Added PUT Request to HTTP Client (esp8266#2310)
Browse files Browse the repository at this point in the history
* Added PUT Request to HTTP Client

* Replaced Tabstops with spaces
  • Loading branch information
fdesoye authored and igrr committed Jul 26, 2016
1 parent 4dc4e75 commit 3fc3e9a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,20 @@ int HTTPClient::POST(String payload)
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
* @param type const char * "GET", "POST", ....
Expand Down
2 changes: 2 additions & 0 deletions libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ class HTTPClient
int GET();
int POST(uint8_t * payload, size_t size);
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, uint8_t * payload = NULL, size_t size = 0);
int sendRequest(const char * type, Stream * stream, size_t size = 0);
Expand Down

0 comments on commit 3fc3e9a

Please sign in to comment.