Skip to content

Commit 84fa438

Browse files
committed
Supports put and delete methods
Because it did not work as expected with tools that use put and delete methods.
1 parent 1c2eb30 commit 84fa438

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

no.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ function build_multipart_data_files($delimiter, $fields, $files) {
116116
curl_setopt( $curl, CURLOPT_HEADER, true ); # include the headers in the output
117117
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); # return output as string
118118

119-
if ( strtolower($_SERVER['REQUEST_METHOD']) == 'post' ) {
120-
curl_setopt( $curl, CURLOPT_POST, true );
119+
if (in_array(strtolower($_SERVER['REQUEST_METHOD']), ['post', 'put', 'delete'], true)) {
120+
curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, $_SERVER['REQUEST_METHOD'] );
121121
$post_data = file_get_contents("php://input");
122122

123123
if (preg_match("/^multipart/", strtolower($_SERVER['CONTENT_TYPE']))) {

0 commit comments

Comments
 (0)