Exemplo n.º 1
1
 /**
  * Return a promise for async requests.
  *
  * @param string $method
  * @param string $url
  * @param array  $body
  * @param array  $query
  * @param array  $headers
  *
  * @return \GuzzleHttp\Promise\PromiseInterface
  */
 public function requestAsync($method, $url, $body = [], $query = [], $headers = [])
 {
     if (!empty($body)) {
         $body = encode($body);
         $headers['Content-Type'] = 'application/json';
     } else {
         $body = null;
     }
     $headers = array_merge($this->global_headers, $headers);
     return $this->client->requestAsync($method, $url, ['query' => $query, 'body' => $body, 'headers' => $headers]);
 }
Exemplo n.º 2
0
 /**
  * Return the value of this object as an object.
  *
  * @return string
  */
 public function __toString()
 {
     return encode($this->all());
 }