Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added PUT Request to HTTP Client #2310

Merged
merged 2 commits into from
Jul 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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