Add PATCH

This commit is contained in:
Bruce Hill 2024-10-28 14:37:30 -04:00
parent ce2aebe910
commit e3c1dd2df5

View File

@ -39,6 +39,14 @@ func _send(method:_Method, url:Text, data:Text?, headers=[:Text] -> HTTPResponse
inline C { inline C {
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, Text$as_c_string($putting)); 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: is DELETE:
inline C { inline C {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE"); 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): func put(url:Text, data="", headers=["Content-Type: application/json", "Accept: application/json"] -> HTTPResponse):
return _send(PUT, url, data, headers) 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): func delete(url:Text, data=!Text, headers=["Content-Type: application/json", "Accept: application/json"] -> HTTPResponse):
return _send(DELETE, url, data, headers) return _send(DELETE, url, data, headers)