From 54fdf3766a6348a9e64c575c6ef544d8b4f9a331 Mon Sep 17 00:00:00 2001 From: wanshan Date: Thu, 14 Aug 2025 17:03:01 +0800 Subject: [PATCH] + [feat] Add patch method in class rest. --- test/lib/rest.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/lib/rest.php b/test/lib/rest.php index e871e77e76..17ddfc77eb 100644 --- a/test/lib/rest.php +++ b/test/lib/rest.php @@ -77,6 +77,33 @@ class rest return $resp; } + /** + * Patch method. + * + * @param string $url + * @param array $data + * @param array $headers + * @access public + * @return object + */ + public function patch($url, $data = array(), $headers = array()) + { + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + $data = json_encode($data); + + $resp = requests::patch($this->base . $url, $headers, $data, array()); + try + { + $resp->body = json_decode($resp->body); + } + catch(Exception $e) + { + } + + return $resp; + } + /** * Put method. *