Skip to content

Commit

Permalink
allow String for payload in HTTPclient sendRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
Links2004 committed Jan 29, 2016
1 parent bf067f7 commit 27f1a63
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ int HTTPClient::POST(String payload) {
return POST((uint8_t *) payload.c_str(), payload.length());
}

/**
* sendRequest
* @param type const char * "GET", "POST", ....
* @param payload String data for the message body
* @return
*/
int HTTPClient::sendRequest(const char * type, String payload) {
return sendRequest(type, (uint8_t *) payload.c_str(), payload.length());
}

/**
* sendRequest
* @param type const char * "GET", "POST", ....
Expand Down
1 change: 1 addition & 0 deletions libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class HTTPClient {
int GET();
int POST(uint8_t * payload, size_t size);
int POST(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 27f1a63

Please sign in to comment.