aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-10-28 14:37:30 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-10-28 14:37:30 -0400
commite3c1dd2df5a593829a4d5864f8ff7ea4582da55c (patch)
treed3b679c63b2e237f5e4c56714aae73f2051c3f69
parentce2aebe91085f987aab31bd2a49820fb605cf386 (diff)
Add PATCH
-rw-r--r--examples/http/http.tm11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/http/http.tm b/examples/http/http.tm
index a1bcccc6..934c8690 100644
--- a/examples/http/http.tm
+++ b/examples/http/http.tm
@@ -39,6 +39,14 @@ func _send(method:_Method, url:Text, data:Text?, headers=[:Text] -> HTTPResponse
inline C {
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, Text$as_c_string($putting));
}
+ is PATCH:
+ inline C {
+ curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PATCH");
+ }
+ if patching := data:
+ inline C {
+ curl_easy_setopt(curl, CURLOPT_POSTFIELDS, Text$as_c_string($patching));
+ }
is DELETE:
inline C {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
@@ -78,6 +86,9 @@ func post(url:Text, data="", headers=["Content-Type: application/json", "Accept:
func put(url:Text, data="", headers=["Content-Type: application/json", "Accept: application/json"] -> HTTPResponse):
return _send(PUT, url, data, headers)
+func patch(url:Text, data="", headers=["Content-Type: application/json", "Accept: application/json"] -> HTTPResponse):
+ return _send(PATCH, url, data, headers)
+
func delete(url:Text, data=!Text, headers=["Content-Type: application/json", "Accept: application/json"] -> HTTPResponse):
return _send(DELETE, url, data, headers)