Skip to content

Commit

Permalink
Merge pull request #2294 from stephenprocter/zhttp_client-put-patch
Browse files Browse the repository at this point in the history
Problem: zhttp_client does not support PUT or PATCH
  • Loading branch information
sphaero authored Aug 5, 2024
2 parents f36c5ed + a166bb8 commit e678127
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/zhttp_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,13 @@ static void zhttp_client_actor (zsock_t *pipe, void *args) {
curl_easy_setopt (curl, CURLOPT_HEADERDATA, request);
curl_easy_setopt (curl, CURLOPT_PRIVATE, request);

if (streq (command, "POST")) {
if (streq (command, "POST") || streq (command, "PUT") ||
streq (command, "PATCH")) {
curl_easy_setopt (curl, CURLOPT_POSTFIELDS, content);
curl_easy_setopt (curl, CURLOPT_POSTFIELDSIZE, content ? strlen (content) : 0);

if (strneq (command, "POST"))
curl_easy_setopt (curl, CURLOPT_CUSTOMREQUEST, command);
}

code = curl_multi_add_handle (multi, curl);
Expand Down

0 comments on commit e678127

Please sign in to comment.