Exemplo n.º 1
0
 /**
  * Manipulate Http Request
  *
  * @param iHttpRequest $request
  */
 function withHttpRequest(iHttpRequest $request)
 {
     $params = \Poirot\Std\iterator_to_array($this);
     $body = json_encode($params);
     $request->setBody($body);
     $request->getHeaders()->set(HeaderFactory::factory('Content-Type', 'application/json'));
 }
Exemplo n.º 2
0
 /**
  * Manipulate Http Request
  *
  * @param iHttpRequest $request
  */
 function withHttpRequest(iHttpRequest $request)
 {
     $params = \Poirot\Std\iterator_to_array($this);
     $body = http_build_query($params, null, '&');
     $request->setBody($body);
     $request->getHeaders()->set(HeaderFactory::factory('Content-Type', 'application/x-www-form-urlencoded'));
 }