You are here

function _restclient_build_resource_path in RESTClient 7.2

Build the URL to connect to

Parameters

string $resource_path: Base path

array $variables: Configuration variables

Return value

string Returns a full URL

2 calls to _restclient_build_resource_path()
_restclient_request in ./restclient.module
Basic request with no body data.
_restclient_request_with_body in ./restclient.module
Requests with body data.

File

./restclient.module, line 819
Defines a standard REST interface to RESTful services

Code

function _restclient_build_resource_path(&$resource_path, &$variables) {
  if (!empty($resource_path)) {
    $url = $variables['endpoint'] . '/' . $resource_path;
  }
  else {
    $url = $variables['endpoint'];
  }

  // Set the options to be used by url()
  $options = array(
    'query' => isset($variables['query']) ? $variables['query'] : '',
    // 'fragment' => $variables['fragment'], @todo add fragment support
    'absolute' => TRUE,
    'alias' => TRUE,
    'external' => TRUE,
  );

  // @todo find a way to skip hook_url_outbound or migrate url() function
  // to internal function
  $url = url($url, $options);
  return $url;
}