Esempio n. 1
0
    public function testBasicAuthentication()
    {
        Unirest\Request::auth('user', 'password');
        $response = Unirest\Request::get('http://httpbin.org/get');

        $this->assertEquals('Basic dXNlcjpwYXNzd29yZA==', $response->body->headers->Authorization);
    }
 public function delete($url)
 {
     Unirest\Request::auth($this->login, $this->pass);
     Unirest\Request::defaultHeader('User-Agent', $this->service . " (" . $this->mail . ")");
     $response = Unirest\Request::delete($this->root . $url . '.json');
     if (floor($response->code / 100) >= 4) {
         throw new Error($response->body->errors->error[0]);
     }
     return $response->body;
 }