Skip to content

Commit

Permalink
No longer rawurlencoding things...
Browse files Browse the repository at this point in the history
  • Loading branch information
dcarbone committed Jul 22, 2016
1 parent 570e691 commit 313e9c5
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions docs/AGENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ object. Below is a quick and sloppy example that also creates a check:
```php
$service = new \DCarbone\PHPConsulAPI\Agent\AgentServiceRegistration(
array(
'Name' => 'dan test service',
'Name' => 'service-name',
'Check' => new \DCarbone\PHPConsulAPI\Agent\AgentServiceCheck(
array(
'HTTP' => 'http://127.0.0.1:8000',
Expand Down Expand Up @@ -100,7 +100,7 @@ object. Below is a quick and sloppy example:
```php
$check = new \DCarbone\PHPConsulAPI\Agent\AgentCheckRegistration(
array(
'Name' => 'dan test service check',
'Name' => 'service-check',
'TCP' => '127.0.0.1:8000',
'Interval' => '10s',
'ServiceID' => 'dan test service'
Expand Down
4 changes: 2 additions & 2 deletions docs/CATALOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $catalogRegistration = new \DCarbone\PHPConsulAPI\Catalog\CatalogRegistration(
'Address' => 'address of node',
'Service' => new \DCarbone\PHPConsulAPI\Agent\AgentService(
array(
'Service' => 'dan-no-space-test',
'Service' => 'service-name',
)
)
)
Expand All @@ -47,7 +47,7 @@ $catalogDeregistration = new \DCarbone\PHPConsulAPI\Catalog\CatalogDeregistratio
array(
'Node' => 'name of node',
'Address' => 'address of node',
'ServiceID' => 'dan-no-space-test'
'ServiceID' => 'service-name'
)
);

Expand Down
20 changes: 10 additions & 10 deletions src/Agent/AgentClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function serviceRegister(AgentServiceRegistration $agentServiceRegistrati
*/
public function serviceDeregister($serviceID)
{
$r = new HttpRequest('put', sprintf('v1/agent/service/deregister/%s', rawurlencode($serviceID)), $this->_Config);
$r = new HttpRequest('put', sprintf('v1/agent/service/deregister/%s', $serviceID), $this->_Config);

list($_, $_, $err) = $this->requireOK($this->doRequest($r));

Expand Down Expand Up @@ -238,7 +238,7 @@ public function failTTL($checkID, $note)
*/
public function updateTTL($checkID, $output, $status)
{
$r = new HttpRequest('put', sprintf('v1/agent/check/update/%s', rawurlencode($checkID)), $this->_Config);
$r = new HttpRequest('put', sprintf('v1/agent/check/update/%s', $checkID), $this->_Config);
$r->body = (new AgentCheckUpdate(['Output' => $output, 'Status' => $status]));

list($_, $_, $err) = $this->requireOK($this->doRequest($r));
Expand Down Expand Up @@ -266,7 +266,7 @@ public function checkRegister(AgentCheckRegistration $agentCheckRegistration)
*/
public function checkDeregister($checkID)
{
$r = new HttpRequest('put', sprintf('v1/agent/check/deregister/%s', rawurlencode($checkID)), $this->_Config);
$r = new HttpRequest('put', sprintf('v1/agent/check/deregister/%s', $checkID), $this->_Config);

list($_, $_, $err) = $this->requireOK($this->doRequest($r));

Expand All @@ -280,7 +280,7 @@ public function checkDeregister($checkID)
*/
public function join($addr, $wan = false)
{
$r = new HttpRequest('put', sprintf('v1/agent/join/%s', rawurlencode($addr)), $this->_Config);
$r = new HttpRequest('put', sprintf('v1/agent/join/%s', $addr), $this->_Config);
if ($wan)
$r->params->set('wan', 1);

Expand All @@ -295,7 +295,7 @@ public function join($addr, $wan = false)
*/
public function forceLeave($node)
{
$r = new HttpRequest('put', sprintf('v1/agent/force-leave/%s', rawurlencode($node)), $this->_Config);
$r = new HttpRequest('put', sprintf('v1/agent/force-leave/%s', $node), $this->_Config);

list($_, $_, $err) = $this->requireOK($this->doRequest($r));

Expand All @@ -309,7 +309,7 @@ public function forceLeave($node)
*/
public function enableServiceMaintenance($serviceID, $reason = '')
{
$r = new HttpRequest('put', sprintf('v1/agent/service/maintenance/%s', rawurlencode($serviceID)), $this->_Config);
$r = new HttpRequest('put', sprintf('v1/agent/service/maintenance/%s', $serviceID), $this->_Config);
$r->params->set('enable', 'true');
$r->params->set('reason', $reason);

Expand All @@ -324,7 +324,7 @@ public function enableServiceMaintenance($serviceID, $reason = '')
*/
public function disableServiceMaintenance($serviceID)
{
$r = new HttpRequest('put', sprintf('v1/agent/service/maintenance/%s', rawurlencode($serviceID)), $this->_Config);
$r = new HttpRequest('put', sprintf('v1/agent/service/maintenance/%s', $serviceID), $this->_Config);
$r->params->set('enable', 'false');

list($_, $_, $err) = $this->requireOK($this->doRequest($r));
Expand Down Expand Up @@ -369,7 +369,7 @@ public function disableNodeMaintenance()
*/
public function checkPass($checkID, $note = '')
{
$r = new HttpRequest('get', sprintf('v1/agent/check/pass/%s', rawurlencode($checkID)), $this->_Config);
$r = new HttpRequest('get', sprintf('v1/agent/check/pass/%s', $checkID), $this->_Config);
$r->params->set('note', $note);

list($_, $_, $err) = $this->requireOK($this->doRequest($r));
Expand All @@ -386,7 +386,7 @@ public function checkPass($checkID, $note = '')
*/
public function checkWarn($checkID, $note = '')
{
$r = new HttpRequest('get', sprintf('v1/agent/check/warn/%s', rawurlencode($checkID)), $this->_Config);
$r = new HttpRequest('get', sprintf('v1/agent/check/warn/%s', $checkID), $this->_Config);
$r->params->set('note', $note);

list($_, $_, $err) = $this->requireOK($this->doRequest($r));
Expand All @@ -403,7 +403,7 @@ public function checkWarn($checkID, $note = '')
*/
public function checkFail($checkID, $note = '')
{
$r = new HttpRequest('get', sprintf('v1/agent/check/fail/%s', rawurlencode($checkID)), $this->_Config);
$r = new HttpRequest('get', sprintf('v1/agent/check/fail/%s', $checkID), $this->_Config);
$r->params->set('note', $note);

list($_, $_, $err) = $this->requireOK($this->doRequest($r));
Expand Down
4 changes: 2 additions & 2 deletions src/Catalog/CatalogClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function services(QueryOptions $queryOptions = null)
*/
public function service($service, $tag = '', QueryOptions $queryOptions = null)
{
$r = new HttpRequest('get', sprintf('v1/catalog/service/%s', rawurlencode($service)), $this->_Config);
$r = new HttpRequest('get', sprintf('v1/catalog/service/%s', $service), $this->_Config);
$r->setQueryOptions($queryOptions);
if ('' !== $tag)
$r->params->set('tag', $tag);
Expand Down Expand Up @@ -191,7 +191,7 @@ public function service($service, $tag = '', QueryOptions $queryOptions = null)
*/
public function node($node, QueryOptions $queryOptions = null)
{
$r = new HttpRequest('get', sprintf('v1/catalog/node/%s', rawurlencode($node)), $this->_Config);
$r = new HttpRequest('get', sprintf('v1/catalog/node/%s', $node), $this->_Config);
$r->setQueryOptions($queryOptions);

list($duration, $response, $err) = $this->requireOK($this->doRequest($r));
Expand Down
2 changes: 1 addition & 1 deletion src/Event/EventClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class EventClient extends AbstractApiClient
*/
public function fire(UserEvent $event, WriteOptions $writeOptions = null)
{
$r = new HttpRequest('put', sprintf('v1/event/fire/%s', rawurlencode($event->Name)), $this->_Config);
$r = new HttpRequest('put', sprintf('v1/event/fire/%s', $event->Name), $this->_Config);
$r->setWriteOptions($writeOptions);

if ('' !== ($nf = $event->NodeFilter))
Expand Down
8 changes: 4 additions & 4 deletions src/Health/HealthClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function node($node, QueryOptions $queryOptions = null)
))];
}

$r = new HttpRequest('get', sprintf('v1/health/node/%s', rawurlencode($node)), $this->_Config);
$r = new HttpRequest('get', sprintf('v1/health/node/%s', $node), $this->_Config);
$r->setQueryOptions($queryOptions);

list($duration, $response, $err) = $this->requireOK($this->doRequest($r));
Expand Down Expand Up @@ -91,7 +91,7 @@ public function checks($service, QueryOptions $queryOptions = null)
))];
}

$r = new HttpRequest('get', sprintf('v1/health/checks/%s', rawurlencode($service)), $this->_Config);
$r = new HttpRequest('get', sprintf('v1/health/checks/%s', $service), $this->_Config);
$r->setQueryOptions($queryOptions);

list($duration, $response, $err) = $this->requireOK($this->doRequest($r));
Expand Down Expand Up @@ -134,7 +134,7 @@ public function service($service, QueryOptions $queryOptions = null)
))];
}

$r = new HttpRequest('get', sprintf('v1/health/checks/%s', rawurlencode($service)), $this->_Config);
$r = new HttpRequest('get', sprintf('v1/health/checks/%s', $service), $this->_Config);
$r->setQueryOptions($queryOptions);

list($duration, $response, $err) = $this->requireOK($this->doRequest($r));
Expand Down Expand Up @@ -180,7 +180,7 @@ public function state($state, QueryOptions $queryOptions = null)
))];
}

$r = new HttpRequest('get', sprintf('v1/health/state/%s', rawurlencode($state)), $this->_Config);
$r = new HttpRequest('get', sprintf('v1/health/state/%s', $state), $this->_Config);
$r->setQueryOptions($queryOptions);

list($duration, $response, $err) = $this->requireOK($this->doRequest($r));
Expand Down
10 changes: 5 additions & 5 deletions src/KV/KVClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function get($key, QueryOptions $queryOptions = null)
))];
}

$r = new HttpRequest('get', sprintf('v1/kv/%s', rawurlencode($key)), $this->_Config);
$r = new HttpRequest('get', sprintf('v1/kv/%s', $key), $this->_Config);
$r->setQueryOptions($queryOptions);

/** @var \DCarbone\PHPConsulAPI\HttpResponse $response */
Expand Down Expand Up @@ -97,7 +97,7 @@ public function valueList($prefix, QueryOptions $queryOptions = null)
))];
}

$r = new HttpRequest('get', sprintf('v1/kv/%s', rawurlencode($prefix)), $this->_Config);
$r = new HttpRequest('get', sprintf('v1/kv/%s', $prefix), $this->_Config);
$r->setQueryOptions($queryOptions);
$r->params->set('recurse', '');

Expand Down Expand Up @@ -145,7 +145,7 @@ public function keys($prefix = null, QueryOptions $queryOptions = null)
if (null === $prefix)
$r = new HttpRequest('get', 'v1/kv/', $this->_Config);
else
$r = new HttpRequest('get', sprintf('v1/kv/%s', rawurlencode($prefix)), $this->_Config);
$r = new HttpRequest('get', sprintf('v1/kv/%s', $prefix), $this->_Config);

$r->setQueryOptions($queryOptions);
$r->params->set('keys', true);
Expand All @@ -171,7 +171,7 @@ public function keys($prefix = null, QueryOptions $queryOptions = null)
*/
public function put(KVPair $KVPair, WriteOptions $writeOptions = null)
{
$r = new HttpRequest('put', sprintf('v1/kv/%s', rawurlencode($KVPair->Key)), $this->_Config);
$r = new HttpRequest('put', sprintf('v1/kv/%s', $KVPair->Key), $this->_Config);
$r->setWriteOptions($writeOptions);
$r->body = ($KVPair);

Expand All @@ -191,7 +191,7 @@ public function put(KVPair $KVPair, WriteOptions $writeOptions = null)
*/
public function delete($key, WriteOptions $writeOptions = null)
{
$r = new HttpRequest('delete', sprintf('v1/kv/%s', rawurlencode($key)), $this->_Config);
$r = new HttpRequest('delete', sprintf('v1/kv/%s', $key), $this->_Config);
$r->setWriteOptions($writeOptions);

list ($duration, $_, $err) = $this->requireOK($this->doRequest($r));
Expand Down
8 changes: 4 additions & 4 deletions src/Session/SessionClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function destroy($id, WriteOptions $writeOptions = null)
))];
}

$r = new HttpRequest('put', sprintf('v1/session/destroy/%s', rawurlencode($id)), $this->_Config);
$r = new HttpRequest('put', sprintf('v1/session/destroy/%s', $id), $this->_Config);
$r->setWriteOptions($writeOptions);

list($duration, $_, $err) = $this->requireOK($this->doRequest($r));
Expand Down Expand Up @@ -140,7 +140,7 @@ public function renew($id, WriteOptions $writeOptions = null)
))];
}

$r = new HttpRequest('put', sprintf('v1/session/renew/%s', rawurlencode($id)), $this->_Config);
$r = new HttpRequest('put', sprintf('v1/session/renew/%s', $id), $this->_Config);
$r->setWriteOptions($writeOptions);

/** @var \Dcarbone\PHPConsulAPI\HttpResponse $response */
Expand Down Expand Up @@ -190,7 +190,7 @@ public function info($id, QueryOptions $queryOptions = null)
))];
}

$r = new HttpRequest('get', sprintf('v1/session/info/%s', rawurlencode($id)), $this->_Config);
$r = new HttpRequest('get', sprintf('v1/session/info/%s', $id), $this->_Config);
$r->setQueryOptions($queryOptions);

list($duration, $response, $err) = $this->requireOK($this->doRequest($r));
Expand Down Expand Up @@ -230,7 +230,7 @@ public function node($node, QueryOptions $queryOptions = null)
))];
}

$r = new HttpRequest('get', sprintf('v1/session/node/%s', rawurlencode($node)), $this->_Config);
$r = new HttpRequest('get', sprintf('v1/session/node/%s', $node), $this->_Config);
$r->setQueryOptions($queryOptions);

list($duration, $response, $err) = $this->requireOK($this->doRequest($r));
Expand Down

0 comments on commit 313e9c5

Please sign in to comment.