/**
  * Test POST with header Content-Type
  */
 public function testHttpPostContentType()
 {
     $response = HTTPClient::post($this->baseuri . 'testPostData.php', array('foo' => 'bar'), array('Content-Type' => Client::ENC_URLENCODED));
     $this->assertTrue($response->isSuccess());
     $this->assertContains('foo', $response->getBody());
     $this->assertContains('bar', $response->getBody());
 }
 public static function postTableData(&$response, $queryString = "", array $postParam = array(), array $additionalHeaders = array())
 {
     $add_url = "http://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}" . APP_NAME . "core/modules/add/post/";
     $headers = self::initHeaders($additionalHeaders);
     $response = json_decode(ClientStatic::post($add_url . $queryString, $postParam, $headers)->getContent(), true);
     if (isset($response['status']) && $response['status'] == self::DUPLICATE) {
         return false;
     } else {
         if (isset($response['status'])) {
             throw new Exception($response['status']);
         }
     }
     return true;
 }
Exemple #3
0
 public function testPostRoleResources()
 {
     $response = ClientStatic::post(self::HOST . '/roles/1/resources', [null], ['Accept' => 'application/hal+json', 'Content-Type' => 'application/json'], json_encode(['resource' => 'ZfeggAdmin\\V1\\Rest\\AdminRole\\Controller::collection', 'privileges' => ['GET', 'post', 'Put', 'delete']]));
     echo Json::prettyPrint($response->getBody());
 }
Exemple #4
0
 public function testPostLogin()
 {
     $response = ClientStatic::post(self::HOST . '/login', ['username' => 'abc', 'password' => 'abc', 'captcha' => 'abc'], ['Accept' => 'application/json']);
     echo Json::prettyPrint($response->getBody());
 }