auth fix
This commit is contained in:
parent
3426f65736
commit
56e72ec7a1
@ -67,7 +67,7 @@ class AtomPubClient
|
|||||||
{
|
{
|
||||||
$client = new HTTPClient($this->url, 'GET');
|
$client = new HTTPClient($this->url, 'GET');
|
||||||
// basic auth, whee
|
// basic auth, whee
|
||||||
$client->setAuth($this->user, $this->password);
|
$client->setAuth($this->user, $this->pass);
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ class AtomPubClient
|
|||||||
if ($response->isOk()) {
|
if ($response->isOk()) {
|
||||||
return $response->getBody();
|
return $response->getBody();
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Bogus return code: " . $response->getStatus());
|
throw new Exception("Bogus return code: " . $response->getStatus() . ': ' . $response->getBody());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ class AtomPubClient
|
|||||||
$response = $client->send();
|
$response = $client->send();
|
||||||
|
|
||||||
if ($response->getStatus() != '201') {
|
if ($response->getStatus() != '201') {
|
||||||
throw new Exception("Expected HTTP 201 on POST, got " . $response->getStatus());
|
throw new Exception("Expected HTTP 201 on POST, got " . $response->getStatus() . ': ' . $response->getBody());
|
||||||
}
|
}
|
||||||
$loc = $response->getHeader('Location');
|
$loc = $response->getHeader('Location');
|
||||||
$contentLoc = $response->getHeader('Content-Location');
|
$contentLoc = $response->getHeader('Content-Location');
|
||||||
@ -142,7 +142,7 @@ class AtomPubClient
|
|||||||
$response = $client->send();
|
$response = $client->send();
|
||||||
|
|
||||||
if ($response->getStatus() != '200' && $response->getStatus() != '204') {
|
if ($response->getStatus() != '200' && $response->getStatus() != '204') {
|
||||||
throw new Exception("Expected HTTP 200 or 204 on PUT, got " . $response->getStatus());
|
throw new Exception("Expected HTTP 200 or 204 on PUT, got " . $response->getStatus() . ': ' . $response->getBody());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -162,7 +162,7 @@ class AtomPubClient
|
|||||||
$response = $client->send();
|
$response = $client->send();
|
||||||
|
|
||||||
if ($response->getStatus() != '200' && $response->getStatus() != '204') {
|
if ($response->getStatus() != '200' && $response->getStatus() != '204') {
|
||||||
throw new Exception("Expected HTTP 200 or 204 on DELETE, got " . $response->getStatus());
|
throw new Exception("Expected HTTP 200 or 204 on DELETE, got " . $response->getStatus() . ': ' . $response->getBody());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user