mirror of
https://github.com/arduino-libraries/ArduinoHttpClient.git
synced 2025-04-19 21:22:15 +03:00
Add support for PATCH operations
This commit is contained in:
parent
68aebb113a
commit
d261fa35f5
@ -17,6 +17,7 @@ WebSocketClient KEYWORD1
|
||||
get KEYWORD2
|
||||
post KEYWORD2
|
||||
put KEYWORD2
|
||||
patch KEYWORD2
|
||||
startRequest KEYWORD2
|
||||
beginRequest KEYWORD2
|
||||
sendHeader KEYWORD2
|
||||
|
@ -332,6 +332,31 @@ int HttpClient::put(const char* aURLPath, const char* aContentType, int aContent
|
||||
return startRequest(aURLPath, HTTP_METHOD_PUT, aContentType, aContentLength, aBody);
|
||||
}
|
||||
|
||||
int HttpClient::patch(const char* aURLPath)
|
||||
{
|
||||
return startRequest(aURLPath, HTTP_METHOD_PATCH);
|
||||
}
|
||||
|
||||
int HttpClient::patch(const String& aURLPath)
|
||||
{
|
||||
return patch(aURLPath.c_str());
|
||||
}
|
||||
|
||||
int HttpClient::patch(const char* aURLPath, const char* aContentType, const char* aBody)
|
||||
{
|
||||
return patch(aURLPath, aContentType, strlen(aBody), (const byte*)aBody);
|
||||
}
|
||||
|
||||
int HttpClient::patch(const String& aURLPath, const String& aContentType, const String& aBody)
|
||||
{
|
||||
return patch(aURLPath.c_str(), aContentType.c_str(), aBody.length(), (const byte*)aBody.c_str());
|
||||
}
|
||||
|
||||
int HttpClient::patch(const char* aURLPath, const char* aContentType, int aContentLength, const byte aBody[])
|
||||
{
|
||||
return startRequest(aURLPath, HTTP_METHOD_PATCH, aContentType, aContentLength, aBody);
|
||||
}
|
||||
|
||||
int HttpClient::del(const char* aURLPath)
|
||||
{
|
||||
return startRequest(aURLPath, HTTP_METHOD_DELETE);
|
||||
|
@ -29,6 +29,7 @@ static const int HTTP_ERROR_INVALID_RESPONSE =-4;
|
||||
#define HTTP_METHOD_GET "GET"
|
||||
#define HTTP_METHOD_POST "POST"
|
||||
#define HTTP_METHOD_PUT "PUT"
|
||||
#define HTTP_METHOD_PATCH "PATCH"
|
||||
#define HTTP_METHOD_DELETE "DELETE"
|
||||
#define HTTP_HEADER_CONTENT_LENGTH "Content-Length"
|
||||
#define HTTP_HEADER_CONTENT_TYPE "Content-Type"
|
||||
@ -104,6 +105,24 @@ public:
|
||||
int put(const String& aURLPath, const String& aContentType, const String& aBody);
|
||||
int put(const char* aURLPath, const char* aContentType, int aContentLength, const byte aBody[]);
|
||||
|
||||
/** Connect to the server and start to send a PATCH request.
|
||||
@param aURLPath Url to request
|
||||
@return 0 if successful, else error
|
||||
*/
|
||||
int patch(const char* aURLPath);
|
||||
int patch(const String& aURLPath);
|
||||
|
||||
/** Connect to the server and send a PATCH request
|
||||
with body and content type
|
||||
@param aURLPath Url to request
|
||||
@param aContentType Content type of request body
|
||||
@param aBody Body of the request
|
||||
@return 0 if successful, else error
|
||||
*/
|
||||
int patch(const char* aURLPath, const char* aContentType, const char* aBody);
|
||||
int patch(const String& aURLPath, const String& aContentType, const String& aBody);
|
||||
int patch(const char* aURLPath, const char* aContentType, int aContentLength, const byte aBody[]);
|
||||
|
||||
/** Connect to the server and start to send a DELETE request.
|
||||
@param aURLPath Url to request
|
||||
@return 0 if successful, else error
|
||||
|
Loading…
x
Reference in New Issue
Block a user