Class: HttpUtils

HttpUtils

HttpUtils is a private class designed manage REST operations with Cloud Foundry components (Cloud controller, UAA, Metrics). It is used by all classes of project.

Constructor

new HttpUtils()

Empty constructor
Source:

Methods

request(options, httpStatusAssert, jsonOutput) → {string}

Stablish a http communications using REST Verbs: GET/POST/PUT/DELETE
Parameters:
Name Type Description
options json [define options to make the request with the CF component]
httpStatusAssert number [set expected http status code (200,201,204, etc...)]
jsonOutput boolan [if the REST method retuns a String or a JSON representation]
Source:
Returns:
[JSON/String]
Type
string
Example
var url = "https://api.run.pivotal.io/v2/info";
      var options = {
          method: 'GET',
          url: url
      };
HttpUtils.request(options, "200", true);

upload(url, options, httpStatusAssert, jsonOutput) → {string}

Method designed to upload zip file to Cloud Controller. It is the unique usage of Restler dependency.
Parameters:
Name Type Description
url string [url]
options json [options]
httpStatusAssert number [set expected http status code (200,201,204, etc...)]
jsonOutput boolan [if the REST method retuns a String or a JSON representation]
Source:
Returns:
[JSON/String]
Type
string