Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d261fa3

Browse filesBrowse files
committed
Add support for PATCH operations
1 parent 68aebb1 commit d261fa3
Copy full SHA for d261fa3

File tree

3 files changed

+45
-0
lines changed
Filter options

3 files changed

+45
-0
lines changed

‎keywords.txt

Copy file name to clipboardExpand all lines: keywords.txt
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ WebSocketClient KEYWORD1
1717
get KEYWORD2
1818
post KEYWORD2
1919
put KEYWORD2
20+
patch KEYWORD2
2021
startRequest KEYWORD2
2122
beginRequest KEYWORD2
2223
sendHeader KEYWORD2

‎src/HttpClient.cpp

Copy file name to clipboardExpand all lines: src/HttpClient.cpp
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,31 @@ int HttpClient::put(const char* aURLPath, const char* aContentType, int aContent
332332
return startRequest(aURLPath, HTTP_METHOD_PUT, aContentType, aContentLength, aBody);
333333
}
334334

335+
int HttpClient::patch(const char* aURLPath)
336+
{
337+
return startRequest(aURLPath, HTTP_METHOD_PATCH);
338+
}
339+
340+
int HttpClient::patch(const String& aURLPath)
341+
{
342+
return patch(aURLPath.c_str());
343+
}
344+
345+
int HttpClient::patch(const char* aURLPath, const char* aContentType, const char* aBody)
346+
{
347+
return patch(aURLPath, aContentType, strlen(aBody), (const byte*)aBody);
348+
}
349+
350+
int HttpClient::patch(const String& aURLPath, const String& aContentType, const String& aBody)
351+
{
352+
return patch(aURLPath.c_str(), aContentType.c_str(), aBody.length(), (const byte*)aBody.c_str());
353+
}
354+
355+
int HttpClient::patch(const char* aURLPath, const char* aContentType, int aContentLength, const byte aBody[])
356+
{
357+
return startRequest(aURLPath, HTTP_METHOD_PATCH, aContentType, aContentLength, aBody);
358+
}
359+
335360
int HttpClient::del(const char* aURLPath)
336361
{
337362
return startRequest(aURLPath, HTTP_METHOD_DELETE);

‎src/HttpClient.h

Copy file name to clipboardExpand all lines: src/HttpClient.h
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ static const int HTTP_ERROR_INVALID_RESPONSE =-4;
2929
#define HTTP_METHOD_GET "GET"
3030
#define HTTP_METHOD_POST "POST"
3131
#define HTTP_METHOD_PUT "PUT"
32+
#define HTTP_METHOD_PATCH "PATCH"
3233
#define HTTP_METHOD_DELETE "DELETE"
3334
#define HTTP_HEADER_CONTENT_LENGTH "Content-Length"
3435
#define HTTP_HEADER_CONTENT_TYPE "Content-Type"
@@ -104,6 +105,24 @@ class HttpClient : public Client
104105
int put(const String& aURLPath, const String& aContentType, const String& aBody);
105106
int put(const char* aURLPath, const char* aContentType, int aContentLength, const byte aBody[]);
106107

108+
/** Connect to the server and start to send a PATCH request.
109+
@param aURLPath Url to request
110+
@return 0 if successful, else error
111+
*/
112+
int patch(const char* aURLPath);
113+
int patch(const String& aURLPath);
114+
115+
/** Connect to the server and send a PATCH request
116+
with body and content type
117+
@param aURLPath Url to request
118+
@param aContentType Content type of request body
119+
@param aBody Body of the request
120+
@return 0 if successful, else error
121+
*/
122+
int patch(const char* aURLPath, const char* aContentType, const char* aBody);
123+
int patch(const String& aURLPath, const String& aContentType, const String& aBody);
124+
int patch(const char* aURLPath, const char* aContentType, int aContentLength, const byte aBody[]);
125+
107126
/** Connect to the server and start to send a DELETE request.
108127
@param aURLPath Url to request
109128
@return 0 if successful, else error

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.