Send the request to the restful endpoint
@param httpMethod
@param path
@param req
540197
function send(httpMethod, path, req) {
    req = req || {};
    httpMethod = httpMethod.toUpperCase();

    var deferred = Q.defer();
    var url = baseUrl + path;
    var data = req.data || {};          // separate out data from request
    delete req.data;

    var isAdmin = req.caller && req.caller.role === 'admin';
    delete req.caller;

    var id = req._id || data._id;       // get id from request or data
    if (req._id) { delete req._id; }    // delete id from request so no dupe

    var session = cls.getNamespace('appSession');
    var caller = session && session.active && session.get('caller');
    if (caller && !isAdmin) {
        _.extend(req, {                 // onBehalfOf used by API to know who is the caller
            onBehalfOfType: caller.type,
            onBehalfOfId:   caller._id + '',
            onBehalfOfRole: caller.role,
            onBehalfOfName: caller.name
        });
    }

    _.each(req, function (val, key) {
        if (!_.isString(val)) { req[key] = JSON.stringify(val); }
    });

    // replace the ID portion of the URL
    url = id ?
        url.replace('{_id}', id + '') :
        url.replace('/{_id}', '');

    var reqConfig = {
        headers:    headers,
        url:        url,
        method:     httpMethod,
        qs:         _.isEmpty(req) ? undefined : req,
        json:       _.isEmpty(data) ? true : data
    };

    // if baseUrl not there yet, wait for 100 seconds until it is (i.e. during system startup)
    if (!baseUrl) {
        setTimeout(function () {
            makeRequest(reqConfig, deferred);
        }, 100);
    }
    else {
        makeRequest(reqConfig, deferred);
    }

    return deferred.promise;
}
117902
@Override
    public Object get(HttpServletRequest req, HttpServletResponse res)
            throws IOException {
        res.sendRedirect(path);
        return null;
    }
1017744
public RouteResult<T> route(HttpMethod method, String path) {
		return route(method, path, Collections.emptyMap());
	}
301610
def post_query(path, data = {})
      @request_uri = "#{@base_uri}#{path}" 
      body = URI.encode_www_form(data)
      extheader = { 'Content-Type' => 'application/x-www-form-urlencoded' }
      req  = post_request(path, body, extheader)
      @res = http_connection.start {|http| http.request(req) }
      handle_error(@res, @request_uri)
      JSON.parse(@res.body)
    end
41440
function getRequest(path, options, callback) {
  if (typeof options === 'function') {
    callback = options;
    options = {
      method: 'get'
    };
  } else {
    options.method = 'get';
  }

  if (options.params) {
    var uri = url.parse(path, true);
    uri.query = _.merge({}, uri.query, options.params);
    path = url.format(uri);
    delete options.params;
  }

  sendRequest(path, options, callback);
}
638296
public void post(String fromPath, String toPath, Status status) {
        http.post(fromPath, redirectRoute(toPath, status));
    }
1283227
def request(method, path, options, raw=false)
      # identify our request
      # @see: http://docs.disqus.com/help/52/
      options ||= {}
      options.merge!(:api_secret => self.api_secret) unless options.has_key?(:api_secret)
      response = connection(raw).send(method) do |request|
        case method
        when :get
          request.url(formatted_path(path), options)
        when :post
          request.path = formatted_path(path)
          request.body = options unless options.empty?
        end
      end
      raw ? response : response.body
    end
807490
def request(method, path, params={})
      headers = @default_headers.merge({'Authorization' => "Bearer #{@access_token}"})
      result = http_client.send_request(method, path, {
        :params  => params,
        :headers => headers
      })
      result
    end
759397
public Response post(String path) throws IOException, RESTException {
        return post(path, null, null);
    }
794360
protected Response httpDelete(String path, int status) {
        return httpRequest(status, null).delete(baseURL + PATH_PREFIX + path);
    }
358923
public HttpPost createPostMethod(final String path, final Map<String, List<String>> params) {
        return new HttpPost(repositoryURL + path + queryString(params));
    }
682108
def request(method, path, *arguments)
      response = http.send(method, path, *arguments)
      response.uri = URI.join(endpoint, path)

      handle_response(response)

    rescue Timeout::Error, Net::OpenTimeout => e
      raise TimeoutError.new(@request, e.message)
    rescue OpenSSL::SSL::SSLError => e
      raise SSLError.new(@request, e.message)
    rescue SocketError,
           EOFError,
           Net::HTTPBadResponse,
           Net::HTTPHeaderSyntaxError,
           Net::HTTPServerException,
           Net::ProtocolError,
           Errno::ECONNABORTED,
           Errno::ECONNREFUSED,
           Errno::ECONNRESET,
           Errno::ETIMEDOUT,
           Errno::ENETUNREACH,
           Errno::EHOSTUNREACH,
           Errno::EINVAL,
           Errno::ENOPROTOOPT => e
      raise ErrnoError.new(@request, e.message)
    rescue Zlib::DataError,
           Zlib::BufError => e
      raise ZlibError.new(@request, e.message)
    end
256300
public static void post(@NotNull String path, @NotNull Handler handler) {
        staticInstance().post(prefixPath(path), handler);
    }
506454
def request(method, path, options)
      response = connection.send(method) do |request|
        case method
        when :get
          request.url(path, options)
        when :post
          request.path = path
          request.body = options unless options.empty?
        else
          raise Error.new("Unhandled request method #{method}")
        end
      end
      return response.body
    end
1342245
protected Response httpGet(String path, int statusCode) {
        return httpRequest(statusCode, null).get(baseURL + PATH_PREFIX + path);
    }
505282
function req (method, path) {
  return async function (data) {
    return await this.request(method, path, data)
  }
}
1102680
public String post(final String path, final byte[] jsonBytes, final boolean gzip) throws IOException, HttpException {
		Preconditions.checkNotNull(path);
		Preconditions.checkArgument(!path.isEmpty());
		Preconditions.checkNotNull(jsonBytes);
		Preconditions.checkArgument(0 < jsonBytes.length);

		HttpURLConnection connection = null;

		try {
			URL url = new URL(apiConfig.getApiUrl() + path);

			// request properties

			connection = (HttpURLConnection) url.openConnection(proxy);
			connection.setDoInput(true);
			connection.setDoOutput(true);
			connection.setRequestProperty("Content-Type", "application/json");

			if (gzip) {
				connection.setRequestProperty("Content-Encoding", "gzip");
			}

			connection.setRequestProperty("X-Stackify-Key", apiConfig.getApiKey());
			connection.setRequestProperty("X-Stackify-PV", "V1");
			connection.setRequestMethod("POST");
			connection.setConnectTimeout(CONNECT_TIMEOUT);
			connection.setReadTimeout(READ_TIMEOUT);

			// write the post body

			OutputStream stream = null;

			if (gzip) {
				stream = new BufferedOutputStream(new GZIPOutputStream(connection.getOutputStream()));
			} else {
				stream = new BufferedOutputStream(connection.getOutputStream());
			}

			stream.write(jsonBytes);
			stream.flush();
			stream.close();

			// read the response

			int statusCode = connection.getResponseCode();

			if (statusCode != HttpURLConnection.HTTP_OK) {
				throw new HttpException(statusCode);
			}

			return readAndClose(connection.getInputStream());

		} finally {

			if (connection != null) {

				// read and close the input stream

				try {
					readAndClose(connection.getInputStream());
				} catch (Throwable t) {
					// do nothing
				}

				// read and close the error stream

				try {
					readAndClose(connection.getErrorStream());
				} catch (Throwable t) {
					// do nothing
				}
			}
		}
	}