Skip to content

Namespaces look like classes #1

@valscion

Description

@valscion

A file that shows this failure:

/**
 * @namespace Holds static functions for HTTP abstraction that works like cbNetwork equivalent.
 */
var HTTP = {};

/**
 * Creates a HTTP GET request and calls the callback with the results.
 *
 * @requires http, url
 *
 * @param {String} url   Address to GET
 * @param {Function} cb  function (statusCode, data) { } statusCode will be 0 on failure
 */
HTTP.get = function (url, cb) {
  var urlObj = urlParser.parse(url);
  http.get({
    host: urlObj.hostname,
    port: 80,
    path: urlObj.path,
    agent: false
  // Let's wait for the server's response
  }, function (res) {
    var data = '';
    // Some data received
    res.on('data', function (chunk) {
      data += chunk;
    });
    // All done
    res.on('end', function () {
      cb(res.statusCode, data);
    });
  // Something went wrong before we got our response
  }).on('error', function (e) {
    cb(0, e.message);
  });
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions