예제 #1
0
 /**
  * @since 0.2
  * @param Request $request
  * @return mixed
  */
 public function postRequest(Request $request)
 {
     $resultArray = $this->client->post(null, array('body' => array_merge($request->getParams(), array('format' => 'json')), 'headers' => $request->getHeaders()))->json();
     $this->triggerErrors($resultArray);
     $this->throwUsageExceptions($resultArray);
     return $resultArray;
 }
예제 #2
0
 /**
  * @param Request $request
  * @param string $bodyOrQuery
  *
  * @throws RequestException
  *
  * @return array as needed by ClientInterface::get and ClientInterface::post
  */
 private function getGuzzleClientRequestOptions(Request $request, $bodyOrQuery)
 {
     return array($bodyOrQuery => array_merge($request->getParams(), array('format' => 'json')), 'headers' => array_merge($this->getDefaultHeaders(), $request->getHeaders()));
 }
예제 #3
0
 /**
  * @param Request $request
  * @param string $paramsKey either 'query' or 'multipart'
  *
  * @throws RequestException
  *
  * @return array as needed by ClientInterface::get and ClientInterface::post
  */
 private function getClientRequestOptions(Request $request, $paramsKey)
 {
     $params = array_merge($request->getParams(), array('format' => 'json'));
     if ($paramsKey === 'multipart') {
         $params = $this->encodeMultipartParams($params);
     }
     return array($paramsKey => $params, 'headers' => array_merge($this->getDefaultHeaders(), $request->getHeaders()));
 }