Add support for update queries
[shpub.git] / src / shpub / Request.php
index 8ee7c5a25f15b37ace9527b15b15195a157267f0..cbcc57e0e4a8e4fe348139ab850c78899dc53667 100644 (file)
@@ -7,6 +7,7 @@ class Request
     public $cfg;
 
     protected $uploadsInfo = [];
+    protected $dedicatedBody = false;
 
     public function __construct($host, $cfg)
     {
@@ -25,6 +26,7 @@ class Request
     public function send($body = null)
     {
         if ($body !== null) {
+            $this->dedicatedBody = true;
             $this->req->setBody($body);
         }
         if ($this->cfg->debug) {
@@ -112,6 +114,10 @@ class Request
             }
         }
 
+        if ($this->dedicatedBody) {
+            $command .= ' --data ' . escapeshellarg($this->req->getBody());
+        }
+
         $command .= ' ' . escapeshellarg((string) $this->req->getUrl());
 
         Log::msg($command);