private function _preparePostRequest($urlPart) { if ($this->auth === TRUE) { $req = new Http_Request($this->baseUrl . $urlPart, array('method' => HTTP_REQUEST_METHOD_POST, 'useBrackets' => FALSE)); $req->addHeader('Connection', 'Keep-Alive'); $req->addHeader('Accept', 'application/json'); $req->setBasicAuth($this->username, $this->password); return $req; } else { throw new Exception("You must authenticate to be able to submit decisions"); } }
<?php /* $Id$ */ require_once '../private/init.php'; /* Инициализируем объект запроса */ $request = Http_Request::create(); /* Инициализируем диспетчер */ $dispatcher = Resources::getInstance()->dispatcher; /* Обрабатываем запрос */ $dispatcher->dispatch($request);
function testSetForValidationOverridesValue() { $_POST['key2'] = '4'; $request = new Http_Request(); $request->setForValidation('key2', '6'); $this->assertEqual('6', $request->getForValidation('key2')); }